PGROUTING  2.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
trsp.h File Reference
#include "postgres.h"
#include <stdint.h>
Include dependency graph for trsp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  edge
 
struct  path_element
 
struct  restrict_struct
 

Macros

#define MAX_RULE_LENGTH   5
 

Typedefs

typedef struct edge edge_t
 
typedef struct path_element path_element_tt
 
typedef struct restrict_struct restrict_t
 

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_tt **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_tt **path, size_t *path_count, char **err_msg)
 

Macro Definition Documentation

#define MAX_RULE_LENGTH   5

Definition at line 25 of file trsp.h.

Referenced by fetch_restrict(), fetch_restriction(), trsp_edge_wrapper(), and trsp_node_wrapper().

Typedef Documentation

typedef struct edge edge_t
typedef struct path_element path_element_tt
typedef struct restrict_struct restrict_t

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_tt **  path,
size_t *  path_count,
char **  err_msg 
)

Definition at line 84 of file trsp_core.cpp.

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

Referenced by compute_trsp().

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

Here is the call graph for this function:

Here is the caller 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_tt **  path,
size_t *  path_count,
char **  err_msg 
)

Definition at line 36 of file trsp_core.cpp.

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

Referenced by compute_trsp().

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

Here is the call graph for this function:

Here is the caller graph for this function: