diff options
| author | MDBijman <matthijs@bijman.org> | 2017-01-24 12:15:26 +0100 |
|---|---|---|
| committer | MDBijman <matthijs@bijman.org> | 2017-01-24 12:15:26 +0100 |
| commit | 070ce923574dcc57435cb3fb2dfe86b6a38cd249 (patch) | |
| tree | ffd69a842ac4ad22aaf7161f923b9f0b47c7147a /Simulator/include/modeling/Datacenter.h | |
Initial code commit with organized dependencies
Diffstat (limited to 'Simulator/include/modeling/Datacenter.h')
| -rw-r--r-- | Simulator/include/modeling/Datacenter.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Simulator/include/modeling/Datacenter.h b/Simulator/include/modeling/Datacenter.h new file mode 100644 index 00000000..a9558f0a --- /dev/null +++ b/Simulator/include/modeling/Datacenter.h @@ -0,0 +1,40 @@ +#pragma once +#include "modeling/Room.h" +#include "simulation/schedulers/Scheduler.h" +#include "modeling/TypeIndex.h" + +#include <vector> + +namespace Modeling +{ + /* + The Datacenter class models a datacenter with rooms/entities. + */ + template<typename ...RoomTypes> + class Datacenter + { + public: + /* + Returns a reference to the vector of rooms in this datacenter. + */ + template<typename RoomType> + std::vector<RoomType>& getRoomsOfType() + { + return std::get<indexOfType<RoomType, RoomTypes...>::value>(rooms); + } + + /* + Adds a room to this datacenter. + */ + template<typename RoomType> + void addRoomOfType(RoomType& room) + { + std::get<indexOfType<RoomType, RoomTypes...>::value>(rooms).push_back(std::move(room)); + } + + + private: + // A vector of rooms that are part of this datacenter. + std::tuple<std::vector<RoomTypes>...> rooms; + }; +} |
