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