PageRenderTime 28ms CodeModel.GetById 17ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/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
 2#ifndef NEBU_PHYSICALRACKFACTORY_H_
 3#define NEBU_PHYSICALRACKFACTORY_H_
 4
 5#include "tinyxml2.h"
 6
 7#include "nebu/topology/physicalRack.h"
 8
 9namespace nebu
10{
11	namespace common
12	{
13
14		/** Creates Racks based on xml. */
15		class PhysicalRackFactory
16		{
17		public:
18			static const std::string ROOT_NAME;
19			static const std::string ATTR_ID;
20
21			/** Simple default (empty) constructor. */
22			PhysicalRackFactory() { };
23			/** Simple default (empty) destructor. */
24			virtual ~PhysicalRackFactory() { };
25
26		  /** Parses a PhysicalRack from the xml.
27			 * @param[in] elem to parse.
28			 * @return a newly created PhysicalRack.
29			 */
30			virtual Traits<PhysicalRack>::Ptr parseXML(const tinyxml2::XMLElement *elem) const;
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<PhysicalRackFactory> 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<PhysicalRackFactory> instance);
42
43		private:
44			static std::shared_ptr<PhysicalRackFactory> instance;
45		};
46
47	}
48}
49
50#endif
51