PGROUTING  3.2
mst_common.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

char * get_name (int fn_id, char *fn_suffix, char **err_msg)
 
int get_order (char *fn_suffix, char **err_msg)
 defines ordering More...
 

Function Documentation

◆ get_name()

char* get_name ( int  fn_id,
char *  fn_suffix,
char **  err_msg 
)

Definition at line 54 of file mst_common.cpp.

54  {
55  std::ostringstream err;
56  try {
57  pgassert(!(*err_msg));
58  std::string name;
59  switch (fn_id) {
60  case 0: name = "pgr_kruskal";
61  break;
62  case 1: name = "pgr_prim";
63  break;
64  default : name = "unknown";
65  err << "Unknown function name";
66  *err_msg = pgr_msg(err.str().c_str());
67  }
68  std::string suffix(fn_suffix);
69  name += suffix;
70  char * full_name = pgr_msg(name.c_str());
71  return full_name;
72  } catch (std::exception &except) {
73  err << except.what();
74  *err_msg = pgr_msg(err.str().c_str());
75  }
76  return nullptr;
77 }

References pgassert, and pgr_msg().

Referenced by process().

◆ get_order()

int get_order ( char *  fn_suffix,
char **  err_msg 
)

defines ordering

Parameters
[in]fn_suffix
[in]err_msg
Returns
0 = no matter 1 = DFS 2 = BFS

Definition at line 34 of file mst_common.cpp.

34  {
35  std::ostringstream err;
36  try {
37  pgassert(!(*err_msg));
38  std::string suffix(fn_suffix);
39  if (suffix.empty()) return 0;
40  if (suffix == "DFS") return 1;
41  if (suffix == "BFS") return 2;
42  if (suffix == "DD") return 1;
43  err << "Unknown function suffix" << suffix;
44  *err_msg = pgr_msg(err.str().c_str());
45  } catch (std::exception &except) {
46  err << except.what();
47  *err_msg = pgr_msg(err.str().c_str());
48  }
49  return -1;
50 }

References pgassert, and pgr_msg().

pgr_msg
char * pgr_msg(const std::string &msg)
Definition: pgr_alloc.cpp:30
pgassert
#define pgassert(expr)
Uses the standard assert syntax.
Definition: pgr_assert.h:94