/include/nebu/topology/physicalRootFactory.h

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

  1. #ifndef NEBU_PHYSICALROOTFACTORY_H_
  2. #define NEBU_PHYSICALROOTFACTORY_H_
  3. #include "tinyxml2.h"
  4. #include "nebu/topology/physicalRoot.h"
  5. namespace nebu
  6. {
  7. namespace common
  8. {
  9. /** Creates a PhysicalRoot from the xml. */
  10. class PhysicalRootFactory
  11. {
  12. public:
  13. static const std::string ROOT_NAME;
  14. static const std::string ATTR_ID;
  15. /** Simple default (empty) constructor. */
  16. PhysicalRootFactory() { };
  17. /** Simple default (empty) destructor. */
  18. virtual ~PhysicalRootFactory() { };
  19. /** Parses a PhysicalRoot from the xml.
  20. * @param[in] elem to parse.
  21. * @return a newly created PhysicalRoot.
  22. */
  23. virtual Traits<PhysicalRoot>::Ptr parseXML(const tinyxml2::XMLElement *elem);
  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<PhysicalRootFactory> 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<PhysicalRootFactory> instance);
  34. private:
  35. static std::shared_ptr<PhysicalRootFactory> instance;
  36. };
  37. }
  38. }
  39. #endif