PGROUTING  3.2
isPlanar_driver.cpp File Reference
#include "drivers/planar/isPlanar_driver.h"
#include <vector>
#include <algorithm>
#include <string>
#include "cpp_common/pgr_alloc.hpp"
#include "cpp_common/pgr_assert.h"
#include "planar/pgr_boyerMyrvold.hpp"
#include "cpp_common/pgr_base_graph.hpp"
Include dependency graph for isPlanar_driver.cpp:

Go to the source code of this file.

Functions

bool do_pgr_isPlanar (pgr_edge_t *data_edges, size_t total_edges, char **log_msg, char **notice_msg, char **err_msg)
 

Function Documentation

◆ do_pgr_isPlanar()

bool do_pgr_isPlanar ( pgr_edge_t data_edges,
size_t  total_edges,
char **  log_msg,
char **  notice_msg,
char **  err_msg 
)

Definition at line 45 of file isPlanar_driver.cpp.

51  {
52  std::ostringstream log;
53  std::ostringstream err;
54  std::ostringstream notice;
55  bool result = false;
56  try {
57  pgassert(!(*log_msg));
58  pgassert(!(*notice_msg));
59  pgassert(!(*err_msg));
60  pgassert(total_edges != 0);
61 
62  graphType gType = UNDIRECTED;
63  log << "Working with Undirected Graph\n";
64  pgrouting::UndirectedGraph undigraph(gType);
65  undigraph.insert_edges(data_edges, total_edges);
67  result = fn_isPlanar.isPlanar(undigraph);
68  return result;
69 
70  pgassert(*err_msg == NULL);
71  *log_msg = log.str().empty()?
72  *log_msg :
73  pgr_msg(log.str().c_str());
74  *notice_msg = notice.str().empty()?
75  *notice_msg :
76  pgr_msg(notice.str().c_str());
77  } catch (AssertFailedException &except) {
78  err << except.what();
79  *err_msg = pgr_msg(err.str().c_str());
80  *log_msg = pgr_msg(log.str().c_str());
81  } catch (std::exception &except) {
82  err << except.what();
83  *err_msg = pgr_msg(err.str().c_str());
84  *log_msg = pgr_msg(log.str().c_str());
85  } catch(...) {
86  err << "Caught unknown exception!";
87  *err_msg = pgr_msg(err.str().c_str());
88  *log_msg = pgr_msg(log.str().c_str());
89  }
90  return result;
91 }

References pgrouting::graph::Pgr_base_graph< G, T_V, T_E >::insert_edges(), pgrouting::functions::Pgr_boyerMyrvold< G >::isPlanar(), pgassert, pgr_msg(), UNDIRECTED, 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
pgassert
#define pgassert(expr)
Uses the standard assert syntax.
Definition: pgr_assert.h:94
UNDIRECTED
@ UNDIRECTED
Definition: graph_enum.h:30
pgrouting::functions::Pgr_boyerMyrvold::isPlanar
bool isPlanar(G &graph)
Definition: pgr_boyerMyrvold.hpp:56
graphType
graphType
Definition: graph_enum.h:30
pgrouting::graph::Pgr_base_graph
Definition: pgr_base_graph.hpp:168
pgrouting::functions::Pgr_boyerMyrvold
Definition: pgr_boyerMyrvold.hpp:47
AssertFailedException
Extends std::exception and is the exception that we throw if an assert fails.
Definition: pgr_assert.h:139