PGROUTING  2.4
 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 #ifdef __cplusplus
31 
32 #include <cstddef>
33 
34 #else // __cplusplus
35 
36 // for bool
37 #ifdef __GNUC__
38 #pragma GCC diagnostic ignored "-pedantic"
39 #endif
40 
41 #include <postgres.h>
42 
43 #ifdef __GNUC__
44 #pragma GCC diagnostic pop
45 #endif
46 
47 // For NULL & size_t
48 #include <stdlib.h>
49 
50 
51 #endif // __cplusplus
52 
53 // For int64_t etc
54 #include <stdint.h>
55 
56 typedef struct {
57  int64_t id;
58  double x;
59  double y;
60 } Coordinate_t;
61 
62 typedef struct edge_astar {
63  int id;
64  int source;
65  int target;
66  double cost;
67  double reverse_cost;
68  double s_x;
69  double s_y;
70  double t_x;
71  double t_y;
72 } edge_astar_t;
73 
74 typedef struct {
75  int64_t id;
76  int64_t source;
77  int64_t target;
78  double cost;
79  double reverse_cost;
80  double x1;
81  double y1;
82  double x2;
83  double y2;
85 
86 
87 typedef struct {
88  int64_t vertex_id;
89  int64_t edge_id;
90  double cost;
92 
93 /*
94  * This one is for processing
95  */
96 struct Path_t{
97  int64_t node;
98  int64_t edge;
99  double cost;
100  double agg_cost;
101 };
102 
103 /*
104  * This ones are for returning the info to postgres
105  */
106 
107 typedef struct {
108  int seq;
109  int64_t start_id;
110  int64_t end_id;
111  int64_t node;
112  int64_t edge;
113  double cost;
114  double agg_cost;
116 
117 
118 typedef struct {
119  int route_id;
120  int path_id;
121  int path_seq;
122  int64_t start_vid;
123  int64_t end_vid;
124  int64_t node;
125  int64_t edge;
126  double cost;
127  double agg_cost;
129 } Routes_t;
130 
131 
132 typedef struct {
133  int64_t id;
134  int64_t source;
135  int64_t target;
136  bool going;
137  bool coming;
138  int64_t edge_id;
140 
141 typedef struct {
142  int64_t id;
143  int64_t source;
144  int64_t target;
145  double cost;
146  double reverse_cost;
147 } pgr_edge_t;
148 
149 typedef struct {
150  int64_t edge;
151  int64_t source;
152  int64_t target;
153  int64_t flow;
155 } pgr_flow_t;
156 
157 typedef struct {
158  int seq;
159  int64_t source;
160  int64_t edge;
161  double cost;
162 } pgr_path_t;
163 
164 typedef struct matrix_cell {
165  int64_t from_vid;
166  int64_t to_vid;
167  double cost;
168 } Matrix_cell_t;
169 
170 // Restrictions used in pgr_turnRestrictions
171 
172 #define MAX_RULE_LENGTH 5
173 typedef struct {
174  int64_t target_id;
175  double to_cost;
176  int64_t via[MAX_RULE_LENGTH];
177 }
178 Restrict_t;
179 
180 typedef struct {
181  int64_t pid;
182  int64_t edge_id;
183  char side; // 'r', 'l', 'b' (default is both)
184  double fraction;
185  int64_t vertex_id; // number is negative and is used for processing
187 
188 // used for getting the data
189 typedef
190 enum {
195 } expectType;
196 
197 typedef
198 struct {
200  uint64_t type;
201  bool strict;
202  char *name;
204 } Column_info_t;
205 
206 
207 /**************************************************************************
208  * return type for contraction
209  * ***********************************************************************/
210 typedef struct {
211  int64_t id;
212  char* type;
213  int64_t source;
214  int64_t target;
215  double cost;
219 
220 
221 
223 
224 /**************************************************************************
225  * pickDelivery types
226  * ***********************************************************************/
227 typedef struct {
228  int64_t id;
229  double x;
230  double y;
231  double demand;
232  double Etime;
233  double Ltime;
234  double Stime;
235  int64_t Pindex;
236  int64_t Dindex;
237  double Ddist;
238 } Customer_t;
239 
240 /*
241  OUT seq INTEGER, done in the .c code
242  OUT vehicle_seq INTEGER,
243  OUT vehicle_id INTEGER,
244  OUT order_id BIGINT,
245  OUT travelTime FLOAT,
246  OUT arrivalTime FLOAT,
247  OUT waitTime FLOAT,
248  OUT serviceTime FLOAT,
249  OUT departureTime FLOAT,
250  */
251 
252 typedef struct {
255  int64_t order_id;
256  double travelTime;
257  double arrivalTime;
258  double waitTime;
259  double serviceTime;
262 
263 /*************************************************************************/
264 
265 #endif // SRC_COMMON_SRC_PGR_TYPES_H_
double y
Definition: pgr_types.h:59
double y
Definition: pgr_types.h:230
int64_t * contracted_vertices
Definition: pgr_types.h:216
int64_t target
Definition: pgr_types.h:77
double reverse_cost
Definition: pgr_types.h:146
struct edge_astar edge_astar_t
expectType
Definition: pgr_types.h:189
int64_t edge_id
Definition: pgr_types.h:138
double x1
Definition: pgr_types.h:80
struct path_element path_element_t
int64_t source
Definition: pgr_types.h:143
int contracted_vertices_size
Definition: pgr_types.h:217
double demand
Definition: pgr_types.h:231
int64_t target
Definition: pgr_types.h:144
double s_y
Definition: pgr_types.h:69
int64_t source
Definition: pgr_types.h:151
double cost
Definition: pgr_types.h:78
int64_t vertex_id
Definition: pgr_types.h:185
double fraction
Definition: pgr_types.h:184
uint64_t type
Definition: pgr_types.h:200
int route_id
Definition: pgr_types.h:119
int64_t source
Definition: pgr_types.h:76
double t_x
Definition: pgr_types.h:70
int64_t id
Definition: pgr_types.h:228
double cost
Definition: pgr_types.h:99
int64_t id
Definition: pgr_types.h:57
char * name
Definition: pgr_types.h:202
int64_t Pindex
Definition: pgr_types.h:235
double y2
Definition: pgr_types.h:83
int64_t end_vid
Definition: pgr_types.h:123
int64_t node
Definition: pgr_types.h:124
int64_t edge
Definition: pgr_types.h:150
double s_x
Definition: pgr_types.h:68
double t_y
Definition: pgr_types.h:71
int64_t edge
Definition: pgr_types.h:98
double x2
Definition: pgr_types.h:82
int64_t edge
Definition: pgr_types.h:160
double to_cost
Definition: pgr_types.h:175
double Stime
Definition: pgr_types.h:234
int64_t id
Definition: pgr_types.h:142
double Ddist
Definition: pgr_types.h:237
int64_t target_id
Definition: pgr_types.h:174
int64_t edge_id
Definition: pgr_types.h:182
double cost
Definition: pgr_types.h:145
int64_t node
Definition: pgr_types.h:97
double y1
Definition: pgr_types.h:81
double route_agg_cost
Definition: pgr_types.h:128
int64_t source
Definition: pgr_types.h:134
int64_t Dindex
Definition: pgr_types.h:236
double x
Definition: pgr_types.h:58
struct matrix_cell Matrix_cell_t
int64_t from_vid
Definition: pgr_types.h:165
double reverse_cost
Definition: pgr_types.h:79
int64_t id
Definition: pgr_types.h:75
int64_t start_vid
Definition: pgr_types.h:122
double Etime
Definition: pgr_types.h:232
graphType
Definition: pgr_types.h:222
int64_t target
Definition: pgr_types.h:135
int64_t edge
Definition: pgr_types.h:125
double cost
Definition: pgr_types.h:126
double Ltime
Definition: pgr_types.h:233
int64_t flow
Definition: pgr_types.h:153
int64_t edge_id
Definition: pgr_types.h:89
double cost
Definition: pgr_types.h:167
int64_t target
Definition: pgr_types.h:152
double x
Definition: pgr_types.h:229
int64_t vertex_id
Definition: pgr_types.h:88
int64_t source
Definition: pgr_types.h:159
int64_t residual_capacity
Definition: pgr_types.h:154
int64_t to_vid
Definition: pgr_types.h:166
int path_id
Definition: pgr_types.h:120
#define MAX_RULE_LENGTH
Definition: pgr_types.h:172
int path_seq
Definition: pgr_types.h:121
int source
Definition: pgr_types.h:64
double reverse_cost
Definition: pgr_types.h:67
double agg_cost
Definition: pgr_types.h:100
double cost
Definition: pgr_types.h:161
double agg_cost
Definition: pgr_types.h:127
int target
Definition: pgr_types.h:65
double cost
Definition: pgr_types.h:66
expectType eType
Definition: pgr_types.h:203
double cost
Definition: pgr_types.h:90