Repository navigation
Expand file tree
/
Copy pathMetroNet.h
More file actions
113 lines (99 loc) · 3.82 KB
/
Copy pathMetroNet.h
File metadata and controls
113 lines (99 loc) · 3.82 KB
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
#ifndef INC_METRONET_H
#define INC_METRONET_H
#pragma once
#include <map>
#include <set>
#include <string>
#include "Passagier.h"
#include "PCC.h"
#include "Albatros.h"
#include "Halte.h"
#include "MetroStation.h"
class Station;
class Tram;
class Passagier;
class MetroNet {
private:
MetroNet* initCheck;
std::map<std::string, Station*> alleStations;
std::map<int, Tram*> alleTrams;
std::set<int> alleSporen;
std::map<std::string, Passagier*> allePassagiers;
public:
// CONSTRUCTOR
/**
\n ENSURE(properlyInitialized(), "constructor must end in properlyInitialized state");
*/
MetroNet();
// DESTRUCTOR
~MetroNet();
// INITIALIZATION CHECK
bool properlyInitialized() const;
// CONSISTENCY CHECK
/**
\n REQUIRE(properlyInitialized(), "MetroNet wasn't initialized when calling isConsistent");
*/
bool isConsistent();
// GETTER METHODS
/**
\n REQUIRE(properlyInitialized(), "MetroNet wasn't initialized when calling getAlleStations");
\n REQUIRE(naam != "", "naam must not be empty");
*/
Station* getStation(std::string naam);
/**
\n REQUIRE(properlyInitialized(), "MetroNet wasn't initialized when calling getAlleTrams");
\n REQUIRE(voertuigNr >= 0, "voertuigNr must be greater or equal to zero");
*/
Tram* getTram(int voertuigNr);
/**
\n REQUIRE(properlyInitialized(), "MetroNet wasn't initialized when calling getPassagier");
\n REQUIRE(naam != "", "naam must not be empty");
*/
Passagier* getPassagier(std::string naam);
// MODIFIER METHODS
/**
\n REQUIRE(properlyInitialized(), "MetroNet wasn't initialized when calling addStation");
\n REQUIRE(getStation(newStation->getNaam()) == nullptr, "This MetroNet already contains a station with this name");
\n ENSURE(getStation(newStation->getNaam()) == newStation, "addStation post condition failure");
*/
void addStation(Station* newStation);
/**
\n REQUIRE(properlyInitialized(), "MetroNet wasn't initialized when calling addTram");
\n REQUIRE(getTram(newTram->voertuigNr()) == nullptr, "This MetroNet already contains a Tram with this voertuigNr");
\n REQUIRE(getStation(newTram->getBeginStation())->isTramInStation(newTram->getLijnNr()) == false, "BeginStation of newTram isn't empty");
\n ENSURE(getTram(newTram->voertuigNr()) == newTram, "addTram post condition failure");
\n ENSURE(getStation(newTram->getBeginStation())->isTramInStation(), "addTram post condition failure");
*/
void addTram(Tram* newTram);
/**
\n REQUIRE(properlyInitialized(), "MetroNet wasn't initialized when calling addPassagier");
\n REQUIRE(getPassagier(newPassagier->getNaam()) == nullptr, "This MetroNet allready contains a passenger with this name");
\n ENSURE(getPassagier(newPassagier->getNaam) == newPassagier, "addPassagier post condition failure");
*/
void addPassagier(Passagier* newPassagier);
/**
\n REQUIRE(properlyInitialized(), "MetroNet wasn't initialized when calling moveAlleTrams");
\n ENSURE(isConsistent(), "moveAlleTrams made MetroNet inconsistent");
*/
void moveAlleTrams(std::ostream& output);
/**
\n REQUIRE(properlyInitialized(), "MetroNet wasn't initialized when calling moveAllePassengers");
*/
void moveAllePassengers(std::ostream& output);
/**
\n REQUIRE(properlyInitialized(), "MetroNet wasn't initialized when calling runSimulation");
\n ENSURE(isConsistent(), "runSimulation made MetroNet inconsistent");
*/
void runSimulation(std::ostream& output, const bool live=false);
// FILE I/O METHODS
/**
\n REQUIRE(isConsistent(), "MetroNet is not consistent");
*/
void writeToOutputStream(std::ostream& output);
/**
\n REQUIRE(isConsistent(), "MetroNet is not consistent");
*/
void drawToOutputStream(std::ostream& output);
void writeToASCII();
};
#endif /* INC_METRONET_H */