/include/nebu/topology/physicalRackFactory.h

https://github.com/deltaforge/nebu-common-cpp · C Header · 51 lines · 24 code · 12 blank · 15 comment · 0 complexity · 7ba1680a934ba1c9c15e4c6d904878d9 MD5 · raw file

  1. #ifndef NEBU_PHYSICALRACKFACTORY_H_
  2. #define NEBU_PHYSICALRACKFACTORY_H_
  3. #include "tinyxml2.h"
  4. #include "nebu/topology/physicalRack.h"
  5. namespace nebu
  6. {
  7. namespace common
  8. {
  9. /** Creates Racks based on xml. */
  10. class PhysicalRackFactory
  11. {
  12. public:
  13. static const std::string ROOT_NAME;
  14. static const std::string ATTR_ID;
  15. /** Simple default (empty) constructor. */
  16. PhysicalRackFactory() { };
  17. /** Simple default (empty) destructor. */
  18. virtual ~PhysicalRackFactory() { };
  19. /** Parses a PhysicalRack from the xml.
  20. * @param[in] elem to parse.
  21. * @return a newly created PhysicalRack.
  22. */
  23. virtual Traits<PhysicalRack>::Ptr parseXML(const tinyxml2::XMLElement *elem) const;
  24. /** Gets an instance of this class.
  25. * Creates one if none has been found previously.
  26. * @return an instance of this class.
  27. */
  28. static std::shared_ptr<PhysicalRackFactory> getInstance();
  29. /** Set an instance of this class to return with getInstance().
  30. * Especially usefull for mocking.
  31. * @param[in] instance to set.
  32. */
  33. static void setInstance(std::shared_ptr<PhysicalRackFactory> instance);
  34. private:
  35. static std::shared_ptr<PhysicalRackFactory> instance;
  36. };
  37. }
  38. }
  39. #endif