PGROUTING  2.6-dev
lineGraph_driver.h File Reference
Include dependency graph for lineGraph_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_lineGraph (pgr_edge_t *data_edges, size_t total_edges, bool directed, Line_graph_rt **return_tuples, size_t *return_count, char **log_msg, char **notice_msg, char **err_msg)
 

Function Documentation

void do_pgr_lineGraph ( pgr_edge_t data_edges,
size_t  total_edges,
bool  directed,
Line_graph_rt **  return_tuples,
size_t *  return_count,
char **  log_msg,
char **  notice_msg,
char **  err_msg 
)

Definition at line 62 of file lineGraph_driver.cpp.

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

Referenced by process().

70  {
71  std::ostringstream log;
72  std::ostringstream err;
73  std::ostringstream notice;
74  try {
75  pgassert(!(*log_msg));
76  pgassert(!(*notice_msg));
77  pgassert(!(*err_msg));
78  pgassert(!(*return_tuples));
79  pgassert(*return_count == 0);
80  pgassert(total_edges != 0);
81 
82  std::vector< Line_graph_rt > results;
83  graphType gType = directed? DIRECTED: UNDIRECTED;
84 
85  pgrouting::DirectedGraph digraph(gType);
86  digraph.insert_edges_neg(data_edges, total_edges);
87 
88  log << digraph << "\n";
92  pgrouting::Basic_edge> line(digraph);
93  std::vector< Line_graph_rt > line_graph_edges;
94  line_graph_edges = line.get_postgres_results_directed();
95  auto count = line_graph_edges.size();
96 
97  if (count == 0) {
98  (*return_tuples) = NULL;
99  (*return_count) = 0;
100  notice <<
101  "Only vertices graph";
102  } else {
103  size_t sequence = 0;
104 
106  line_graph_edges,
107  return_tuples,
108  sequence);
109  (*return_count) = sequence;
110  }
111 
112  pgassert(*err_msg == NULL);
113  *log_msg = log.str().empty()?
114  *log_msg :
115  pgr_msg(log.str().c_str());
116  *notice_msg = notice.str().empty()?
117  *notice_msg :
118  pgr_msg(notice.str().c_str());
119  } catch (AssertFailedException &except) {
120  (*return_tuples) = pgr_free(*return_tuples);
121  (*return_count) = 0;
122  err << except.what();
123  *err_msg = pgr_msg(err.str().c_str());
124  *log_msg = pgr_msg(log.str().c_str());
125  } catch (std::exception &except) {
126  (*return_tuples) = pgr_free(*return_tuples);
127  (*return_count) = 0;
128  err << except.what();
129  *err_msg = pgr_msg(err.str().c_str());
130  *log_msg = pgr_msg(log.str().c_str());
131  } catch(...) {
132  (*return_tuples) = pgr_free(*return_tuples);
133  (*return_count) = 0;
134  err << "Caught unknown exception!";
135  *err_msg = pgr_msg(err.str().c_str());
136  *log_msg = pgr_msg(log.str().c_str());
137  }
138 }
Extends std::exception and is the exception that we throw if an assert fails.
Definition: pgr_assert.h:126
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, Line_vertex, Basic_edge > LinearDirectedGraph
Data type to handle graph -> lineGaph transformation.
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
void get_postgres_result(std::vector< Line_graph_rt > edge_result, Line_graph_rt **return_tuples, size_t &sequence)
graphType
Definition: graph_enum.h:30

Here is the call graph for this function:

Here is the caller graph for this function: