-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRentings.h
75 lines (59 loc) · 1.62 KB
/
Rentings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*****************************************************************//**
* \file Rentings.h
* \brief
*
* \author Diogo Pinto & Ricardo Cruz
* \date May 2023
*********************************************************************/
#define DATE_SIZE 100
#pragma region GRAPH_STRUCT
typedef struct Node {
int idNode;
double longitude;
double latitude;
struct Node* next;
struct Edge* Adj;
} Node;
typedef struct Edge {
float distance;
int destination;
struct Edge* next;
} Edge;
#pragma endregion
#pragma region RENTING_STRUCT
typedef struct Renting {
int idTransport;
int idNode;
char startDate[DATE_SIZE];
char endDate[DATE_SIZE];
int nifRenting;
float totalPrice;
struct Renting* next;
} Renting;
#pragma endregion
#pragma region PICKUP_STRUCT
typedef struct Pickup {
int idNode;
struct Transports* next;
};
#pragma endregion
#pragma region SHORTEST_PATH_STRUCT
typedef struct {
float distance;
int previous;
int visited;
} ShortestPathInfo;
#pragma endregion
#pragma region FUNCTIONS
Node* read_nodes_from_file();
Edge* read_edges_from_file();
void print_nodes(Node* nodes_head);
Edge* read_edges_from_file(Node* nodes_head);
Node* find_node_by_id(int node_id, Node* nodes_head);
void list_nodes_with_edges(Node* nodes_head);
void free_edges_list(Edge* edges_head);
void free_nodes_list(Node* nodes_head);
double haversine_distance(double lat1, double lon1, double lat2, double lon2);
//void listTransportsByLocation(Transports* transports_head, int locationID);
//void find_nodes_within_radius(Node* nodes_head, double target_latitude, double target_longitude, Transports* transports_head);
#pragma endregion