PGROUTING  2.6-dev
johnson_driver.h File Reference
Include dependency graph for johnson_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_johnson (pgr_edge_t *data_edges, size_t total_tuples, bool directed, Matrix_cell_t **return_tuples, size_t *return_count, char **log_msg, char **err_msg)
 

Function Documentation

void do_pgr_johnson ( pgr_edge_t data_edges,
size_t  total_tuples,
bool  directed,
Matrix_cell_t **  return_tuples,
size_t *  return_count,
char **  log_msg,
char **  err_msg 
)

Definition at line 42 of file johnson_driver.cpp.

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

Referenced by process().

49  {
50  std::ostringstream log;
51  std::ostringstream err;
52 
53  try {
54  pgassert(!(*log_msg));
55  pgassert(!(*err_msg));
56  pgassert(!(*return_tuples));
57  pgassert(*return_count == 0);
58 
59  graphType gType = directed? DIRECTED: UNDIRECTED;
60 
61  std::deque< Path >paths;
62 
63  if (directed) {
64  log << "Processing Directed graph\n";
65  pgrouting::DirectedGraph digraph(gType);
66  digraph.insert_edges(data_edges, total_tuples);
67  pgr_johnson(digraph, *return_count, return_tuples);
68  } else {
69  log << "Processing Undirected graph\n";
70  pgrouting::UndirectedGraph undigraph(gType);
71  undigraph.insert_edges(data_edges, total_tuples);
72  pgr_johnson(undigraph, *return_count, return_tuples);
73  }
74 
75 
76  if (*return_count == 0) {
77  log << "No result generated, report this error\n";
78  *log_msg = pgr_msg(err.str().c_str());
79  *return_tuples = NULL;
80  *return_count = 0;
81  return;
82  }
83 
84 
85  *log_msg = log.str().empty()?
86  *log_msg :
87  pgr_msg(log.str().c_str());
88  } catch (AssertFailedException &except) {
89  (*return_tuples) = pgr_free(*return_tuples);
90  (*return_count) = 0;
91  err << except.what();
92  *err_msg = pgr_msg(err.str().c_str());
93  *log_msg = pgr_msg(log.str().c_str());
94  } catch (std::exception &except) {
95  (*return_tuples) = pgr_free(*return_tuples);
96  (*return_count) = 0;
97  err << except.what();
98  *err_msg = pgr_msg(err.str().c_str());
99  *log_msg = pgr_msg(log.str().c_str());
100  } catch(...) {
101  (*return_tuples) = pgr_free(*return_tuples);
102  (*return_count) = 0;
103  err << "Caught unknown exception!";
104  *err_msg = pgr_msg(err.str().c_str());
105  *log_msg = pgr_msg(log.str().c_str());
106  }
107 }
Extends std::exception and is the exception that we throw if an assert fails.
Definition: pgr_assert.h:126
T * pgr_free(T *ptr)
Definition: pgr_alloc.hpp:77
#define pgassert(expr)
Uses the standard assert syntax.
Definition: pgr_assert.h:81
char * pgr_msg(const std::string &msg)
Definition: pgr_alloc.cpp:30
virtual const char * what() const
Definition: pgr_assert.cpp:53
graphType
Definition: graph_enum.h:30
void pgr_johnson(G &graph, std::vector< Matrix_cell_t > &rows)

Here is the call graph for this function:

Here is the caller graph for this function: