-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCompany.h
157 lines (127 loc) · 6.92 KB
/
Company.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#ifndef COMPANY_H
#define COMPANY_H
#include <iostream>
#include <string.h>
#include <set>
//TODO maybe remove
//#include "EscapeRoomWrapper.h"
#include "ScaryRoom.h"
#include "KidsRoom.h"
#include "Enigma.h"
#include "Exceptions.h"
using std::set;
using std::string;
namespace mtm{
namespace escaperoom{
typedef enum{
SCARY_ROOM, KIDS_ROOM, BASE_ROOM
}RoomType;
class Company{
string name;
string phoneNumber;
set<EscapeRoomWrapper*> rooms;
public:
//// Constructs a new Company with the specified data.
//
// @param name : the name of the company.
// @param phoneNumber : the phone number of the company.
//
Company(string name, string phoneNumber);
//CopyConstructor
//
Company(const Company& company);
//Assignment operation
//
Company& operator=(const Company& company);
//Function creates a basic escape room using the parameters and adds the room created to the company.
//
// @param name : the name of the escape room.
// @param escapeTime : the maximal escape time allowed in the room.
// @param level : the level of the escape room.
// @param maxParticipants: the maximal participants allowed in the room.
// @throws CompanyMemoryProblemException in case of room creation failure.
void createRoom(char* name, const int& escapeTime, const int& level, const int& maxParticipants);
//Function creates a scary escape room using the parameters and adds the room created to the company.
//
// @param name : the name of the escape room.
// @param escapeTime : the maximal escape time allowed in the room.
// @param level : the level of the escape room.
// @param maxParticipants: the maximal participants allowed in the room.
// @param ageLimit : the age limit for the room.
// @param numOfScaryEnigmas : the number of scary enigmas in the room.
// @throws CompanyMemoryProblemException in case of room creation failure.
void createScaryRoom(char* name, const int& escapeTime, const int& level, const int& maxParticipants, const int& ageLimit, const int& numOfScaryEnigmas);
//Function creates a scary escape room using the parameters and adds the room created to the company.
//
// @param name : the name of the escape room.
// @param escapeTime : the maximal escape time allowed in the room.
// @param level : the level of the escape room.
// @param maxParticipants: the maximal participants allowed in the room.
// @param ageLimit : the age limit for the room.
// @throws CompanyMemoryProblemException in case of room creation failure.
void createKidsRoom(char* name, const int& escapeTime, const int& level, const int& maxParticipants, const int& ageLimit);
//Function returns a set of all the rooms in the company.
//
set<EscapeRoomWrapper*> getAllRooms() const;
//Function removes the room specified from the company.
//
// @param room : the room to be removed.
// @throws : CompanyRoomNotFoundException in case that room doesnt exist in company.
void removeRoom(const EscapeRoomWrapper& room);
//Function adds the enigma to the room specified.
//
// @param room : the room to be updated.
// @param enigma : the enigma to be added.
// @throws : CompanyRoomNotFoundException in case that room doesnt exist in company.
void addEnigma(const EscapeRoomWrapper& room, const Enigma& enigma);
//Function removes the enigma from the room specified.
//
// @param room : the room to be updated.
// @param enigma : the enigma to be removed.
// @throws : CompanyRoomNotFoundException in case that room doesnt exist in company.
// @throws : CompanyRoomHasNoEnigmasException in case the room is empty.
// @throws : CompanyRoomEnigmaNotFoundException in case enigma doesnt exist in room.
void removeEnigma(const EscapeRoomWrapper& room, const Enigma& enigma);
//Function adds the item to the enigma from the room specified.
//
// @param room : the room to be updated.
// @param enigma : the enigma to be updated.
// @param element : the element to be added.
// @throws : CompanyRoomNotFoundException in case that room doesnt exist in company.
// @throws : CompanyRoomEnigmaNotFoundException in case enigma doesnt exist in room.
void addItem(const EscapeRoomWrapper& room, const Enigma& enigma, const string& element);
//Function removes the item from the enigma from the room specified.
//
// @param room : the room to be updated.
// @param enigma : the enigma to be removed.
// @param element : the element to be removed.
// @throws : CompanyRoomNotFoundException in case that room doesnt exist in company.
// @throws : CompanyRoomEnigmaNotFoundException in case enigma doesnt exist in room.
// @throws : CompanyRoomEnigmaHasNoElementsException in case enigma has no elements;
// @throws : CompanyRoomEnigmaElementNotFoundException in case element doesnt exist in enigma.
void removeItem(const EscapeRoomWrapper& room, const Enigma& enigma, const string& element);
//Function returns all the rooms in the specified type.
//
// @param: type : the type requested.
set<EscapeRoomWrapper*> getAllRoomsByType(RoomType type) const;
//Function returns the room with the specified name.
//
// @param: name : the name of the room requested.
// @throws: CompanyRoomNotFoundException if room doesnt exist.
EscapeRoomWrapper* getRoomByName(const string& name) const;
// Prints the data of the company in the following format:
//
// "<CompanyName> : <PhoneNumber>
// <Room>
// <Room> …"
//
// @param output : the output stream to which the data is printed.
// @param company : the company whose data is printed.
friend std::ostream& operator<<(std::ostream& output, const Company& company);
//Destructor
~Company();
};
std::ostream& operator<<(std::ostream& output, const Company& company);
}
}
#endif //COMPANY_H