-
Notifications
You must be signed in to change notification settings - Fork 3k
/
Copy pathElevator.hpp
53 lines (43 loc) · 943 Bytes
/
Elevator.hpp
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
#ifndef ELEVATOR_HPP
#define ELEVATOR_HPP
#include <vector>
#include <queue>
#include <string>
#include "Request.hpp"
enum class Direction {
UP,
DOWN,
IDLE
};
enum class Status {
MOVING,
STOPPED,
MAINTENANCE
};
class Elevator {
private:
int id;
int currentFloor;
Direction direction;
Status status;
int maxFloor;
int minFloor;
std::vector<bool> floorsToVisit;
std::queue<Request> requests;
public:
Elevator(int id, int maxFloor, int minFloor = 0);
int getId() const;
int getCurrentFloor() const;
Direction getDirection() const;
Status getStatus() const;
void setDirection(Direction direction);
void setStatus(Status status);
void addRequest(const Request& request);
void moveToNextFloor();
bool hasStopRequest() const;
void processFloor();
void displayInfo() const;
private:
void updateDirection();
};
#endif