|
PGROUTING
3.2
|
Go to the documentation of this file.
46 std::vector<pgr_topologicalSort_t>
67 std::ostringstream log;
68 std::ostringstream err;
69 std::ostringstream notice;
81 std::vector<pgr_topologicalSort_t> results;
83 log <<
"Working with Directed Graph\n";
89 auto count = results.size();
92 (*return_tuples) = NULL;
99 (*return_tuples) =
pgr_alloc(count, (*return_tuples));
100 for (
size_t i = 0; i < count; i++) {
101 *((*return_tuples) + i) = results[i];
103 (*return_count) = count;
106 *log_msg = log.str().empty()?
109 *notice_msg = notice.str().empty()?
113 (*return_tuples) =
pgr_free(*return_tuples);
115 err << except.
what();
116 *err_msg =
pgr_msg(err.str().c_str());
117 *log_msg =
pgr_msg(log.str().c_str());
118 }
catch (std::exception &except) {
119 (*return_tuples) =
pgr_free(*return_tuples);
121 err << except.what();
122 *err_msg =
pgr_msg(err.str().c_str());
123 *log_msg =
pgr_msg(log.str().c_str());
125 (*return_tuples) =
pgr_free(*return_tuples);
127 err <<
"Caught unknown exception!";
128 *err_msg =
pgr_msg(err.str().c_str());
129 *log_msg =
pgr_msg(log.str().c_str());
T * pgr_alloc(std::size_t size, T *ptr)
allocates memory
char * pgr_msg(const std::string &msg)
virtual const char * what() const
static std::vector< pgr_topologicalSort_t > pgr_topologicalSort(G &graph)
#define pgassert(expr)
Uses the standard assert syntax.
std::vector< pgr_topologicalSort_t > topologicalSort(G &graph)
void insert_edges(const T *edges, size_t count)
Inserts count edges of type T into the graph.
void do_pgr_topologicalSort(pgr_edge_t *data_edges, size_t total_edges, pgr_topologicalSort_t **return_tuples, size_t *return_count, char **log_msg, char **notice_msg, char **err_msg)
An assert functionality that uses C++ throw().
graph::Pgr_base_graph< BG, XY_vertex, Basic_edge > G
Extends std::exception and is the exception that we throw if an assert fails.