PGROUTING  3.2
transitiveClosure_driver.h File Reference
#include <stddef.h>
#include "c_types/transitiveClosure_rt.h"
#include "c_types/pgr_edge_t.h"
Include dependency graph for transitiveClosure_driver.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void do_pgr_transitiveClosure (pgr_edge_t *data_edges, size_t total_tuples, transitiveClosure_rt **return_tuples, size_t *return_count, char **log_msg, char **notice_msg, char **err_msg)
 

Function Documentation

◆ do_pgr_transitiveClosure()

void do_pgr_transitiveClosure ( pgr_edge_t data_edges,
size_t  total_tuples,
transitiveClosure_rt **  return_tuples,
size_t *  return_count,
char **  log_msg,
char **  notice_msg,
char **  err_msg 
)

Definition at line 94 of file transitiveClosure_driver.cpp.

101  {
102  std::ostringstream log;
103  std::ostringstream notice;
104  std::ostringstream err;
105  try {
106  pgassert(total_edges != 0);
107  pgassert(!(*log_msg));
108  pgassert(!(*notice_msg));
109  pgassert(!(*err_msg));
110  pgassert(!(*return_tuples));
111  pgassert(*return_count == 0);
112 
113  /*
114  * Converting to C++ structures
115  */
116  std::vector<pgr_edge_t> edges(data_edges, data_edges + total_edges);
117 
118 
119  graphType gType = DIRECTED;
120  pgrouting::DirectedGraph digraph(gType);
121  digraph.insert_edges(data_edges, total_edges);
122 
124  digraph,
125  return_tuples,
126  return_count);
127 
128  *log_msg = log.str().empty()?
129  *log_msg :
130  pgr_msg(log.str().c_str());
131  *notice_msg = notice.str().empty()?
132  *notice_msg :
133  pgr_msg(notice.str().c_str());
134  } catch (AssertFailedException &except) {
135  (*return_tuples) = pgr_free(*return_tuples);
136  (*return_count) = 0;
137  err << except.what();
138  *err_msg = pgr_msg(err.str().c_str());
139  *log_msg = pgr_msg(log.str().c_str());
140  } catch (std::exception &except) {
141  (*return_tuples) = pgr_free(*return_tuples);
142  (*return_count) = 0;
143  err << except.what();
144  *err_msg = pgr_msg(err.str().c_str());
145  *log_msg = pgr_msg(log.str().c_str());
146  } catch(...) {
147  (*return_tuples) = pgr_free(*return_tuples);
148  (*return_count) = 0;
149  err << "Caught unknown exception!";
150  *err_msg = pgr_msg(err.str().c_str());
151  *log_msg = pgr_msg(log.str().c_str());
152  }
153 }

References DIRECTED, get_postgres_result(), pgrouting::graph::Pgr_base_graph< G, T_V, T_E >::insert_edges(), pgassert, pgr_free(), pgr_msg(), and AssertFailedException::what().

Referenced by process().

pgr_msg
char * pgr_msg(const std::string &msg)
Definition: pgr_alloc.cpp:30
AssertFailedException::what
virtual const char * what() const
Definition: pgr_assert.cpp:67
get_postgres_result
static void get_postgres_result(G &graph, transitiveClosure_rt **return_tuples, size_t *count)
Definition: transitiveClosure_driver.cpp:52
pgassert
#define pgassert(expr)
Uses the standard assert syntax.
Definition: pgr_assert.h:94
graphType
graphType
Definition: graph_enum.h:30
DIRECTED
@ DIRECTED
Definition: graph_enum.h:30
pgr_free
T * pgr_free(T *ptr)
Definition: pgr_alloc.hpp:77
pgrouting::graph::Pgr_base_graph
Definition: pgr_base_graph.hpp:168
AssertFailedException
Extends std::exception and is the exception that we throw if an assert fails.
Definition: pgr_assert.h:139