PageRenderTime 19ms CodeModel.GetById 16ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

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