PGROUTING  2.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
trsp_driver.cpp File Reference
#include <string.h>
#include <sstream>
#include "GraphDefinition.h"
#include "trsp_driver.h"
Include dependency graph for trsp_driver.cpp:

Go to the source code of this file.

Functions

int trsp_edge_wrapper (edge_t *edges, size_t edge_count, restrict_t *restricts, size_t restrict_count, int64_t start_edge, double start_pos, int64_t end_edge, double end_pos, bool directed, bool has_reverse_cost, path_element_t **path, size_t *path_count, char **err_msg)
 
int trsp_node_wrapper (edge_t *edges, size_t edge_count, restrict_t *restricts, size_t restrict_count, int64_t start_vertex, int64_t end_vertex, bool directed, bool has_reverse_cost, path_element_t **path, size_t *path_count, char **err_msg)
 

Function Documentation

int trsp_edge_wrapper ( edge_t edges,
size_t  edge_count,
restrict_t restricts,
size_t  restrict_count,
int64_t  start_edge,
double  start_pos,
int64_t  end_edge,
double  end_pos,
bool  directed,
bool  has_reverse_cost,
path_element_t **  path,
size_t *  path_count,
char **  err_msg 
)

Definition at line 84 of file trsp_driver.cpp.

References MAX_RULE_LENGTH, GraphDefinition::my_dijkstra(), and restrict_struct::via.

94  {
95  std::ostringstream log;
96  try {
97  std::vector<PDVI> ruleTable;
98 
99  int j;
100  ruleTable.clear();
101  for (size_t i = 0; i < restrict_count; i++) {
102  std::vector<int64_t> seq;
103  seq.clear();
104  seq.push_back(restricts[i].target_id);
105  for (j = 0; j < MAX_RULE_LENGTH && restricts[i].via[j] >- 1; j++) {
106  seq.push_back(restricts[i].via[j]);
107  }
108  ruleTable.push_back(make_pair(restricts[i].to_cost, seq));
109  }
110 
111  GraphDefinition gdef(edges, static_cast<unsigned int>(edge_count),
112  directed, has_reverse_cost);
113 
114  int64_t start_vertex = 0;
115  int64_t end_vertex = 0;
116  gdef.add_virtual_vertices(
117  start_edge, start_pos,
118  end_edge, end_pos,
119  start_vertex, end_vertex);
120 
121  gdef.set_restrictions(start_vertex, end_vertex, ruleTable);
122  int res = gdef.my_dijkstra(start_vertex, end_vertex, path, path_count,
123  log);
124 
125 
126  if (res < 0)
127  return res;
128  else
129  return EXIT_SUCCESS;
130  }
131  catch(std::exception& e) {
132  log << e.what();
133  *err_msg = strdup(log.str().c_str());
134  return -1;
135  }
136  catch(...) {
137  log << "Caught unknown exception!";
138  *err_msg = strdup(log.str().c_str());
139  return -1;
140  }
141 }
#define MAX_RULE_LENGTH
Definition: trsp.h:25
int via[5]
Definition: trsp.h:42

Here is the call graph for this function:

int trsp_node_wrapper ( edge_t edges,
size_t  edge_count,
restrict_t restricts,
size_t  restrict_count,
int64_t  start_vertex,
int64_t  end_vertex,
bool  directed,
bool  has_reverse_cost,
path_element_t **  path,
size_t *  path_count,
char **  err_msg 
)

Definition at line 34 of file trsp_driver.cpp.

References MAX_RULE_LENGTH, GraphDefinition::my_dijkstra(), and restrict_struct::via.

42  {
43 
44  std::ostringstream log;
45  try {
46  std::vector<PDVI> ruleTable;
47 
48  int j;
49  ruleTable.clear();
50  for (size_t i = 0; i < restrict_count; i++) {
51  std::vector<int64_t> seq;
52  seq.clear();
53  seq.push_back(restricts[i].target_id);
54  for (j = 0; j < MAX_RULE_LENGTH && restricts[i].via[j] > -1; j++) {
55  seq.push_back(restricts[i].via[j]);
56  }
57  ruleTable.push_back(make_pair(restricts[i].to_cost, seq));
58  }
59 
60  GraphDefinition gdef(edges, static_cast<unsigned int>(edge_count),
61  directed, has_reverse_cost);
62  gdef.set_restrictions(start_vertex, end_vertex, ruleTable);
63  int res = gdef.my_dijkstra(start_vertex, end_vertex, path, path_count,
64  log);
65 
66 
67  if (res < 0)
68  return res;
69  else
70  return EXIT_SUCCESS;
71  }
72  catch(std::exception& e) {
73  log << e.what();
74  *err_msg = strdup(log.str().c_str());
75  return -1;
76  }
77  catch(...) {
78  log << "Caught unknown exception!";
79  *err_msg = strdup(log.str().c_str());
80  return -1;
81  }
82 }
#define MAX_RULE_LENGTH
Definition: trsp.h:25
int via[5]
Definition: trsp.h:42

Here is the call graph for this function: