00001 00014 #ifndef __FACTORYOBJECTCONFIGS__H__ 00015 #define __FACTORYOBJECTCONFIGS__H__ 00016 00017 #include "tinyxml/tinyxml.h" 00018 #include "objects/Object.h" 00019 #include "Factory.h" 00020 #include "Singleton.h" 00021 #include "common.h" 00022 00026 namespace FactoryObjectConfigsDeclar { 00030 template <typename IdentifierType, class AbstractProduct> 00031 class FactoryObjectConfigsError { 00032 public: 00036 static AbstractProduct * OnUnknownType(IdentifierType id) { 00037 THROW(ExceptionFactoryObjectConfigs, 00038 string("Unknown type of instance: ") + id); 00039 } 00040 00041 protected: 00045 ~FactoryObjectConfigsError() {} 00046 }; 00047 00051 typedef Object::Config ProductType; 00052 00056 typedef string IdentifierType; 00057 00062 typedef TiXmlElement * InitializerType; 00063 00067 typedef Object::Config * (* CreateFunctionType)(const InitializerType &); 00068 } 00069 00073 typedef Singleton< 00074 Factory< 00075 FactoryObjectConfigsDeclar::ProductType, 00076 FactoryObjectConfigsDeclar::IdentifierType, 00077 FactoryObjectConfigsDeclar::InitializerType, 00078 FactoryObjectConfigsDeclar::CreateFunctionType, 00079 FactoryObjectConfigsDeclar::FactoryObjectConfigsError 00080 > 00081 > FactoryObjectConfigs; 00082 00083 #endif /* #ifndef __FACTORYOBJECTCONFIGS__H__ */ 00084 00085 /* End of file FactoryObjectConfigs.h */