osurs  0.0.1
types.h
Go to the documentation of this file.
1 
11 #ifndef OSURS_TYPES_H_
12 #define OSURS_TYPES_H_
13 
14 #include <osurs/ds.h>
15 #include <stdlib.h>
16 
17 #define MINUTES 60
18 #define HOURS 3600
19 
20 // Forward declarations to enable circular dependencies
21 struct node_t;
22 struct stop_t;
23 struct trip_t;
24 struct route_t;
25 struct vehicle_t;
26 struct composition_t;
27 struct connection_t;
28 struct reservation_t;
29 struct network_t;
30 struct seat_t;
31 struct seat_collection_t;
32 
38 typedef struct node_t {
39  char *id;
40  double x;
41  double y;
43 } Node;
44 
52 typedef struct stop_t {
56  int *reserved;
58  struct node_t *node;
59  struct stop_t *prev;
60  struct stop_t *next;
61 } Stop;
62 
71 typedef struct trip_t {
72  char *id;
73  int departure;
75  int arrival;
77  struct vehicle_t *vehicle;
79  struct trip_t *next;
80  struct route_t *route;
82 } Trip;
83 
91 typedef struct route_t {
92  char *id;
93  struct stop_t
95  struct trip_t
97  size_t route_size;
98  size_t trip_size;
100 
106 typedef struct vehicle_t {
107  char *id;
110 
117 typedef struct composition_t {
118  char *id;
121  int *seat_ids;
123 
130 typedef struct network_t {
136 
142 typedef struct connection_t {
143  int departure;
144  int arrival;
145  int available;
146  struct stop_t *orig;
147  struct stop_t *dest;
148  struct trip_t
149  *trip;
150  struct connection_t
151  *next;
153  struct connection_t
154  *prev;
156 
163 typedef struct reservation_t {
164  char id[37];
165  int res_id;
166  int seats;
167  struct stop_t *orig;
168  struct stop_t *dest;
169  struct trip_t *trip;
172 
178 typedef struct seat_t {
179  int seat_id;
180  int res_count;
181  int *res_id_arr;
183 
190 typedef struct seat_collection_t {
194 
195 #endif // OSURS_TYPES_H_
Data structures for efficient data handling.
Arraylist.
Definition: arraylist.h:25
A hashmap.
Definition: hashmap.h:39
A composition.
Definition: types.h:117
char * id
Definition: types.h:118
int seat_count
Definition: types.h:119
int * seat_ids
Definition: types.h:121
A connection.
Definition: types.h:142
struct stop_t * dest
Definition: types.h:147
int available
Definition: types.h:145
struct stop_t * orig
Definition: types.h:146
struct connection_t * prev
Definition: types.h:153
struct trip_t * trip
Definition: types.h:148
struct connection_t * next
Definition: types.h:150
int departure
Definition: types.h:143
int arrival
Definition: types.h:144
A network.
Definition: types.h:130
HashMap * compositions
Definition: types.h:134
HashMap * routes
Definition: types.h:132
HashMap * nodes
Definition: types.h:131
HashMap * vehicles
Definition: types.h:133
A node.
Definition: types.h:38
HashMap * routes
Definition: types.h:42
double x
Definition: types.h:40
double y
Definition: types.h:41
char * id
Definition: types.h:39
A reservation.
Definition: types.h:163
int seats
Definition: types.h:166
struct stop_t * dest
Definition: types.h:168
struct trip_t * trip
Definition: types.h:169
int res_id
Definition: types.h:165
struct stop_t * orig
Definition: types.h:167
A route.
Definition: types.h:91
struct stop_t * root_stop
Definition: types.h:93
struct trip_t * root_trip
Definition: types.h:95
char * id
Definition: types.h:92
size_t route_size
Definition: types.h:97
size_t trip_size
Definition: types.h:98
A seat collection.
Definition: types.h:190
Seat ** seat_arr
Definition: types.h:191
int seat_count
Definition: types.h:192
A seat.
Definition: types.h:178
int * res_id_arr
Definition: types.h:181
int seat_id
Definition: types.h:179
int res_count
Definition: types.h:180
A stop.
Definition: types.h:52
int arrival_offset
Definition: types.h:54
int departure_offset
Definition: types.h:55
struct node_t * node
Definition: types.h:58
struct stop_t * prev
Definition: types.h:59
int time_to_next
Definition: types.h:53
struct stop_t * next
Definition: types.h:60
int * reserved
Definition: types.h:56
A trip.
Definition: types.h:71
int arrival
Definition: types.h:75
struct vehicle_t * vehicle
Definition: types.h:77
struct trip_t * next
Definition: types.h:79
char * id
Definition: types.h:72
ArrayList * reservations
Definition: types.h:81
int departure
Definition: types.h:73
struct route_t * route
Definition: types.h:80
A vehicle.
Definition: types.h:106
struct composition_t * composition
Definition: types.h:108
char * id
Definition: types.h:107
struct composition_t Composition
A composition.
struct seat_t Seat
A seat.
struct stop_t Stop
A stop.
struct trip_t Trip
A trip.
struct reservation_t Reservation
A reservation.
struct route_t Route
A route.
struct node_t Node
A node.
struct seat_collection_t SeatCollection
A seat collection.
struct connection_t Connection
A connection.
struct vehicle_t Vehicle
A vehicle.
struct network_t Network
A network.