-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathList.h
108 lines (95 loc) · 2.62 KB
/
List.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//
// List.h
// testt
//
// Created by Burak on 15/04/2017.
// Copyright © 2017 Burak. All rights reserved.
//
#ifndef List_h
#define List_h
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
struct flight{
int id;
int seat_count;
struct flight * next;
pthread_mutex_t mutex;
int counts_of_solds;
int counts_of_reserved;
int counts_of_cancelled;
};
struct airline{
int id;
struct airline * next;
struct flight* flight;
};
struct reservation{
int transaction_id;
struct reservation *next;
};
struct customer{
int id;
int max_operation;
int max_reserve;
int counts_of_buy;
int counts_of_reserve;
int counts_of_cancel;
int counts_of_nothing;
int r;
pthread_mutex_t mutex;
struct customer * next;
struct reservation * reservation;
};
struct ticket_officer{
int id;
int counts_of_buy;
int counts_of_reserve;
int counts_of_cancel;
int counts_of_nothing;
pthread_mutex_t mutex;
pthread_mutex_t customer;
pthread_mutex_t customer_request;
struct ticket_officer * next;
struct request * request;
};
struct transaction{
int id;
int customer_id;
int officer_id;
int operation;
int simulation_day;
int success;
int airline_id;
int flight_id;
int seat_count;
struct transaction * next;
};
struct request{
int customer_id;
int operation;
int airline_id;
int flight_id;
int seat_count;
int transaction_id;
struct request * next;
};
extern struct customer *customer_list, *insert_list, *temp;
extern struct airline *airline_list, *airline_insert_list, *airline_temp;
extern struct ticket_officer *ticket_officer_list, *ticket_officer_insert_list, *ticket_officer_temp;
extern struct transaction *transaction_list;
extern struct request *request_list, *request_list_back;
struct customer* search(int id);
struct ticket_officer* search_ticket_officer(int id);
struct airline* search_airline(int id);
struct transaction* search_transaction(int id);
struct flight* search_flight(int id, int airline_id);
void set_customers(int id, int max_operation, int max_reserve);
void set_ticket_officer(int id);
int set_transactions(int trans_id, int customer_id, int officer_id, int operation, int simulation_day, int success, int airline_id, int flight_id, int seat_count);
void set_request_tt(int customer_id, int operation, int airline_id, int flight_id, int seat_count, int transaction_id, int ticket_officer_id);
void set_airlines(int id);
void set_flights(int id, int airline_id);
void set_reservations(int transaction_id, int customer_id);
#endif /* List_h */