pgRouting
pgRouting extends the PostGIS / PostgreSQL geospatial database to provide geospatial routing functionality.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pgr_types.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 File: pgr_types.h
3 
4 Copyright (c) 2015 Celia Virginia Vergara Castillo
5 Mail: vicky_vergara@hotmail.com
6 
7 ------
8 
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 
23 ********************************************************************PGR-GNU*/
24 
25 #ifndef SRC_COMMON_SRC_PGR_TYPES_H_
26 #define SRC_COMMON_SRC_PGR_TYPES_H_
27 #pragma once
28 
29 
30 #ifndef __cplusplus
31 
32 // for bool
33 #include <postgres.h>
34 
35 // For NULL & size_t
36 #include <stdlib.h>
37 #endif
38 
39 // For int64_t etc
40 #include <stdint.h>
41 
42 typedef struct {
43  int64_t id;
44  double x;
45  double y;
46 } Coordinate_t;
47 
48 typedef struct edge_astar {
49  int id;
50  int source;
51  int target;
52  double cost;
53  double reverse_cost;
54  double s_x;
55  double s_y;
56  double t_x;
57  double t_y;
58 } edge_astar_t;
59 
60 typedef struct {
61  int64_t id;
62  int64_t source;
63  int64_t target;
64  double cost;
65  double reverse_cost;
66  double x1;
67  double y1;
68  double x2;
69  double y2;
71 
72 
73 typedef struct {
74  int64_t vertex_id;
75  int64_t edge_id;
76  double cost;
78 
79 /*
80  * This one is for processing
81  */
82 typedef struct {
83  int64_t node;
84  int64_t edge;
85  double cost;
86  double agg_cost;
87 } Path_t;
88 
89 /*
90  * This ones are for returning the info to postgres
91  */
92 
93 typedef struct {
94  int seq;
95  int64_t start_id;
96  int64_t end_id;
97  int64_t node;
98  int64_t edge;
99  double cost;
100  double agg_cost;
102 
103 
104 typedef struct {
105  int route_id;
106  int path_id;
107  int path_seq;
108  int64_t start_vid;
109  int64_t end_vid;
110  int64_t node;
111  int64_t edge;
112  double cost;
113  double agg_cost;
115 } Routes_t;
116 
117 
118 typedef struct {
119  int64_t id;
120  int64_t source;
121  int64_t target;
122  bool going;
123  bool coming;
124  int64_t edge_id;
126 
127 typedef struct {
128  int64_t id;
129  int64_t source;
130  int64_t target;
131  double cost;
132  double reverse_cost;
133 } pgr_edge_t;
134 
135 typedef struct {
136  int64_t edge;
137  int64_t source;
138  int64_t target;
139  int64_t flow;
141 } pgr_flow_t;
142 
143 typedef struct {
144  int seq;
145  int64_t source;
146  int64_t edge;
147  double cost;
148 } pgr_path_t;
149 
150 typedef struct matrix_cell {
151  int64_t from_vid;
152  int64_t to_vid;
153  double cost;
154 } Matrix_cell_t;
155 
156 // Restrictions used in pgr_turnRestrictions
157 
158 #define MAX_RULE_LENGTH 5
159 typedef struct {
160  int64_t target_id;
161  double to_cost;
162  int64_t via[MAX_RULE_LENGTH];
163 }
164 Restrict_t;
165 
166 typedef struct {
167  int64_t pid;
168  int64_t edge_id;
169  char side; // 'r', 'l', 'b' (default is both)
170  double fraction;
171  int64_t vertex_id; // number is negative and is used for processing
173 
174 // used for getting the data
175 typedef
176 enum {
181 } expectType;
182 
183 typedef
184 struct {
186  uint64_t type;
187  bool strict;
188  char *name;
190 } Column_info_t;
191 
193 
194 /**************************************************************************
195  * pickDelivery types
196  * ***********************************************************************/
197 typedef struct {
198  int64_t id;
199  double x;
200  double y;
201  double demand;
202  double Etime;
203  double Ltime;
204  double Stime;
205  int64_t Pindex;
206  int64_t Dindex;
207  double Ddist;
208 } Customer_t;
209 
210 /*
211  OUT seq INTEGER, done in the .c code
212  OUT vehicle_seq INTEGER,
213  OUT vehicle_id INTEGER,
214  OUT order_id BIGINT,
215  OUT travelTime FLOAT,
216  OUT arrivalTime FLOAT,
217  OUT waitTime FLOAT,
218  OUT serviceTime FLOAT,
219  OUT departureTime FLOAT,
220 */
221 
222 typedef struct {
225  int64_t order_id;
226  double travelTime;
227  double arrivalTime;
228  double waitTime;
229  double serviceTime;
232 
233 /*************************************************************************/
234 
235 #endif // SRC_COMMON_SRC_PGR_TYPES_H_
double y
Definition: pgr_types.h:45
double y
Definition: pgr_types.h:200
int64_t target
Definition: pgr_types.h:63
double reverse_cost
Definition: pgr_types.h:132
struct edge_astar edge_astar_t
expectType
Definition: pgr_types.h:175
int64_t edge_id
Definition: pgr_types.h:124
double x1
Definition: pgr_types.h:66
struct path_element path_element_t
int64_t source
Definition: pgr_types.h:129
double demand
Definition: pgr_types.h:201
int64_t target
Definition: pgr_types.h:130
double s_y
Definition: pgr_types.h:55
int64_t source
Definition: pgr_types.h:137
double cost
Definition: pgr_types.h:64
int64_t vertex_id
Definition: pgr_types.h:171
double fraction
Definition: pgr_types.h:170
uint64_t type
Definition: pgr_types.h:186
int route_id
Definition: pgr_types.h:105
int64_t source
Definition: pgr_types.h:62
double t_x
Definition: pgr_types.h:56
int64_t id
Definition: pgr_types.h:198
double cost
Definition: pgr_types.h:85
int64_t id
Definition: pgr_types.h:43
char * name
Definition: pgr_types.h:188
int64_t Pindex
Definition: pgr_types.h:205
double y2
Definition: pgr_types.h:69
int64_t end_vid
Definition: pgr_types.h:109
int64_t node
Definition: pgr_types.h:110
int64_t edge
Definition: pgr_types.h:136
double s_x
Definition: pgr_types.h:54
double t_y
Definition: pgr_types.h:57
int64_t edge
Definition: pgr_types.h:84
double x2
Definition: pgr_types.h:68
int64_t edge
Definition: pgr_types.h:146
double to_cost
Definition: pgr_types.h:161
double Stime
Definition: pgr_types.h:204
int64_t id
Definition: pgr_types.h:128
double Ddist
Definition: pgr_types.h:207
int64_t target_id
Definition: pgr_types.h:160
int64_t edge_id
Definition: pgr_types.h:168
double cost
Definition: pgr_types.h:131
int64_t node
Definition: pgr_types.h:83
double y1
Definition: pgr_types.h:67
double route_agg_cost
Definition: pgr_types.h:114
int64_t source
Definition: pgr_types.h:120
int64_t Dindex
Definition: pgr_types.h:206
double x
Definition: pgr_types.h:44
struct matrix_cell Matrix_cell_t
int64_t from_vid
Definition: pgr_types.h:151
double reverse_cost
Definition: pgr_types.h:65
int64_t id
Definition: pgr_types.h:61
int64_t start_vid
Definition: pgr_types.h:108
double Etime
Definition: pgr_types.h:202
graphType
Definition: pgr_types.h:192
int64_t target
Definition: pgr_types.h:121
int64_t edge
Definition: pgr_types.h:111
double cost
Definition: pgr_types.h:112
double Ltime
Definition: pgr_types.h:203
int64_t flow
Definition: pgr_types.h:139
int64_t edge_id
Definition: pgr_types.h:75
double cost
Definition: pgr_types.h:153
int64_t target
Definition: pgr_types.h:138
double x
Definition: pgr_types.h:199
int64_t vertex_id
Definition: pgr_types.h:74
int64_t source
Definition: pgr_types.h:145
int64_t residual_capacity
Definition: pgr_types.h:140
int64_t to_vid
Definition: pgr_types.h:152
int path_id
Definition: pgr_types.h:106
#define MAX_RULE_LENGTH
Definition: pgr_types.h:158
int path_seq
Definition: pgr_types.h:107
int source
Definition: pgr_types.h:50
double reverse_cost
Definition: pgr_types.h:53
double agg_cost
Definition: pgr_types.h:86
double cost
Definition: pgr_types.h:147
double agg_cost
Definition: pgr_types.h:113
int target
Definition: pgr_types.h:51
double cost
Definition: pgr_types.h:52
expectType eType
Definition: pgr_types.h:189
double cost
Definition: pgr_types.h:76