PGROUTING  2.6
trsp.h
Go to the documentation of this file.
1 /*
2  * Shortest path with turn restrictions algorithm for PostgreSQL
3  *
4  * Copyright (c) 2011 Stephen Woodbridge
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  *
20  */
21 
22 #ifndef INCLUDE_C_TYPES_TRSP_TRSP_H_
23 #define INCLUDE_C_TYPES_TRSP_TRSP_H_
24 
25 #define MAX_RULE_LENGTH 5
26 
27 #include "postgres.h"
28 #include <stdint.h>
29 
30 
31 typedef struct edge {
32  long id;
33  long source;
34  long target;
35  float8 cost;
36  float8 reverse_cost;
37 } edge_t;
38 
39 typedef struct restrict_struct {
40  int target_id;
41  float8 to_cost;
42  int via[MAX_RULE_LENGTH];
43 }
45 
46 typedef struct path_element {
47  long vertex_id;
48  long edge_id;
49  float8 cost;
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
57  edge_t *edges,
58  size_t edge_count,
59  restrict_t *restricts,
60  size_t restrict_count,
61  int64_t start_vertex,
62  int64_t end_vertex,
63  bool directed,
64  bool has_reverse_cost,
65  path_element_tt **path,
66  size_t *path_count,
67  char **err_msg
68 );
69 
71  edge_t *edges,
72  size_t edge_count,
73  restrict_t *restricts,
74  size_t restrict_count,
75  int64_t start_edge,
76  double start_pos,
77  int64_t end_edge,
78  double end_pos,
79  bool directed,
80  bool has_reverse_cost,
81  path_element_tt **path,
82  size_t *path_count,
83  char **err_msg
84 );
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif // INCLUDE_C_TYPES_TRSP_TRSP_H_
float8 cost
Definition: trsp.h:35
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: trsp_core.cpp:83
Definition: trsp.h:31
long id
Definition: trsp.h:32
struct path_element path_element_tt
long edge_id
Definition: trsp.h:48
int target_id
Definition: trsp.h:40
struct restrict_struct restrict_t
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: trsp_core.cpp:35
float8 cost
Definition: trsp.h:49
float8 to_cost
Definition: trsp.h:41
#define MAX_RULE_LENGTH
Definition: trsp.h:25
struct edge edge_t
long target
Definition: trsp.h:34
long vertex_id
Definition: trsp.h:47
float8 reverse_cost
Definition: trsp.h:36
long source
Definition: trsp.h:33