Creating a component and Object Factory
Now that we have built a stage factory, building a component factory should be easy. Let's take a look at what a component and object factory would look like:
//Component Factory class M5ComponentFactory { public: ~M5ComponentFactory(void); void AddBuilder(M5ComponentTypes type, M5ComponentBuilder* builder); void RemoveBuilder(M5ComponentTypes type); M5Component* Build(M5ComponentTypes type); void ClearBuilders(void); private: typedef std::unordered_map<M5ComponentTypes, M5ComponentBuilder*> BuilderMap; typedef BuilderMap::iterator MapItor; BuilderMap m_builderMap; }; //Object Factory class M5ObjectFactory { public: ~ M5ObjectFactory (void); void AddBuilder(M5ArcheTypes type, M5ObjectBuilder* builder); void RemoveBuilder(M5ArcheTypes type); M5Object* Build(M5ArcheTypes type); void ClearBuilders(void); private: typedef std::unordered_map...