-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRoadUser.h
50 lines (46 loc) · 1.61 KB
/
RoadUser.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
#ifndef TRAFFICLIGHTSYSTEM_ROADUSER_H
#define TRAFFICLIGHTSYSTEM_ROADUSER_H
#include "User.h"
#include "Junction.h"
#include "Road.h"
//class containing attributes and methods associated with Road user
class RoadUser : User {
public:
//constructor - when no data is provided
RoadUser();
//constructor - when data is provided
RoadUser(Junction junction, Road road, string type);
void move();
//executes drive functionality simultaneosuly to traffic light functionality
thread drive();
//method to turn the road user to the next road after leaving the previous road
void thruJunction();
//method to tell road user whether they are reaching the junction
bool isPassJunction();
//vector of junctions representing the user's path in the grid
vector<Junction*> juncSeq;
//iterator to walk through vector of junctions
vector<Junction*>::iterator juncSeqPtr;
void setCurrentJunction(Junction *currentJunction);
void setNextJunction(Junction *nextJunction);
void setCurrentRoad(Road *currentRoad);
void setNextRoad(Road *nextRoad);
bool reachDestination = false;
string type = "c";
private:
Junction* currentJunction;
Junction* nextJunction;
Road* currentRoad;
Road* nextRoad;
//variable to represent whether road user has passed the previous junction
bool flag_passed = true;
};
// |N |N
// + |
// * | * |
//W==+===========+===============E
// * | * | *
// + |
// S===============S
// *
#endif //TRAFFICLIGHTSYSTEM_ROADUSER_H