forked from mooman/Raymond-Tree-Simulation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsite.h
45 lines (35 loc) · 914 Bytes
/
site.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
#ifndef SITE_H_
#define SITE_H_
class Simulator;
class Site {
public:
//constructor
Site(RaymondTree *, Simulator *, Messenger *);
void process_event (Event *);
void process_token_request (Event *);
void process_token_received ();
void execute_cs ();
void release_cs ();
float average_response_time ();
//id for tree construction
int id;
//id based on user input
int site_id;
int holder;
//stats variables
int cs_requests;
int response_times;
Queue * times_request_cs;
int time_finish_cs;
// pointer to the parent site
Site* parent;
Site* left;
Site* right;
RaymondTree* tree_ptr;
private:
Queue * request_q;
Messenger * m;
Simulator * s;
bool executing_cs;
};
#endif /*SITE_H_*/