-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoardingStatus.hpp
More file actions
44 lines (32 loc) · 1006 Bytes
/
BoardingStatus.hpp
File metadata and controls
44 lines (32 loc) · 1006 Bytes
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
#ifndef BOARDING_STATUS_HPP_
#define BOARDING_STATUS_HPP_
#include "Subject.hpp"
#include <vector>
#include <memory>
/**
* A concrete implementation of the Observer DP Subject/Publisher interface
* BoardingStatus is final - No class will be derived from BoardingStatus
*/
class BoardingStatus final : public Subject
{
public:
BoardingStatus():m_isBoardingOpen(false)
{
//To avoid reallocation and faster processing
//A flight can expect maximum of 300 passengers
m_passengers.reserve(300);
}
void registerObserver(Observer* Observer) override;
void deregisterObserver(Observer* Observer) override;
void notifyObservers() override;
~BoardingStatus() {}
/**
* Set the new state of Flight Boarding Status
*/
void setBoardingStatus(const bool& isBoardingOpen);
private:
// Boarding status observing passengers
std::vector<Observer*> m_passengers;
bool m_isBoardingOpen;
};
#endif // BOARDING_STATUS_HPP_