PageRenderTime 22ms CodeModel.GetById 9ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/include/nebu/topology/physicalHost.h

https://github.com/deltaforge/nebu-common-cpp
C Header | 78 lines | 43 code | 11 blank | 24 comment | 0 complexity | f74b1c7cc868c07c01410b24f5e5fe3d MD5 | raw file
 1
 2#ifndef NEBU_PHYSICALHOST_H_
 3#define NEBU_PHYSICALHOST_H_
 4
 5#include "nebu/identifiable.h"
 6#include "nebu/traits.h"
 7
 8namespace nebu
 9{
10	namespace common
11	{
12
13		class PhysicalRack;
14		class PhysicalLocalStore;
15		
16		/** Holds the information on a host of the physical topology. */
17		class PhysicalHost : public Identifiable
18		{
19		public:
20			/** Simple constructor.
21			 * Sets the uuid as specified and inits the parent to NULL.
22			 * @param[in] uuid to set.
23			 */
24			explicit PhysicalHost(const std::string &uuid) : Identifiable(uuid), parent(NULL) { }
25			/** Simple destructor. */
26			virtual ~PhysicalHost() { }
27
28			/** Getter for the parent.
29			 * @return the rack that is the parent.
30			 */
31			virtual PhysicalRack *getParent() const
32			{
33				return this->parent;
34			}
35			/** Sets the parent.
36			 * @param[in] parent to set.
37			 */
38			virtual void setParent(PhysicalRack *parent)
39			{
40				this->parent = parent;
41			}
42
43			/** Gets the local stores of the rack.
44			 * @return a map of the localstores (uuid => PhysicalLocalStore).
45			 */
46			virtual const Traits<PhysicalLocalStore>::Map &getLocalStores() const
47			{
48				return this->localStores;
49			}
50			/** Sets the local stores of the rack.
51			 * @param[in] localStores to set.
52			 */
53			virtual void setLocalStores(Traits<PhysicalLocalStore>::Map localStores)
54			{
55				this->localStores = localStores;
56			}	
57			/** Adds a local store to the rack.
58			 * @param[in] localStore to add.
59			 */
60			virtual void addLocalStore(Traits<PhysicalLocalStore>::Ptr localStore);
61			/** Removes the local store with the given uuid.
62			 * @param[in] uuid of the store to remove.
63			 */
64			virtual void removeLocalStore(const std::string &uuid)
65			{
66				this->localStores.erase(uuid);
67			}
68
69		private:
70			PhysicalRack *parent;
71			Traits<PhysicalLocalStore>::Map localStores;
72		};
73
74	}
75}
76
77#endif
78