osurs  0.0.1
reserve.h
Go to the documentation of this file.
1 
17 #ifndef OSURS_RESERVE_H_
18 #define OSURS_RESERVE_H_
19 
20 #include "osurs/network.h"
21 
41 Connection *new_connection(const Node *orig, const Node *dest, int time);
42 
58 int check_connection(Connection *connection, int seats, int *trip_count);
59 
70 Connection *select_connection(Connection *connection, int seats);
71 
72 /*
73  * Reserve connection
74  *
75  * Books a connection on the network, if the desired seats are available. If
76  * enough seats are available the reservation counts of the corresponding trip
77  * on the stops of the routes are increased.
78  *
79  * Returns 0 if failure and 1 if success.
80  */
81 
95 Reservation *new_reservation(Connection *connection, int seats, char *id);
96 
97 // Destructor-like methods
98 
109 void delete_connection(Connection *connection);
110 
111 #endif // OSURS_RESERVE_H_
Network for reservation optimization.
void delete_connection(Connection *connection)
Delete a connection.
Definition: connection.c:132
Reservation * new_reservation(Connection *connection, int seats, char *id)
Create a new reservation.
Definition: reservation.c:20
Connection * select_connection(Connection *connection, int seats)
Selects the best connection.
Definition: connection.c:100
Connection * new_connection(const Node *orig, const Node *dest, int time)
Create connection between nodes.
Definition: connection.c:37
int check_connection(Connection *connection, int seats, int *trip_count)
Check if seats are available in connection.
Definition: connection.c:76
A connection.
Definition: types.h:142
A node.
Definition: types.h:38
A reservation.
Definition: types.h:163