FactoryObjects.h

Go to the documentation of this file.
00001 
00013 #ifndef __FACTORYOBJECTS__H__
00014 #define __FACTORYOBJECTS__H__
00015 
00016 #include "objects/Object.h"
00017 #include "Factory.h"
00018 #include "Singleton.h"
00019 #include "common.h"
00020 
00024 namespace FactoryObjectsDeclar {
00028         template <typename IdentifierType, class AbstractProduct>
00029         class FactoryObjectsError {
00030         public:
00034                 static AbstractProduct * OnUnknownType(IdentifierType id) {
00035                         THROW(ExceptionFactoryObjects,
00036                                 string("Unknown type of instance: ") + id);
00037                 }
00038 
00039         protected:
00043                 ~FactoryObjectsError() {}
00044         };
00045 
00049         typedef Object ProductType;
00050 
00054         typedef string IdentifierType;
00055 
00060         typedef Object::Config InitializerType;
00061 
00065         typedef Object * (* CreateFunctionType)(const InitializerType &);
00066 }
00067 
00071 typedef Singleton<
00072         Factory<
00073                 FactoryObjectsDeclar::ProductType,
00074                 FactoryObjectsDeclar::IdentifierType,
00075                 FactoryObjectsDeclar::InitializerType,
00076                 FactoryObjectsDeclar::CreateFunctionType,
00077                 FactoryObjectsDeclar::FactoryObjectsError
00078         >
00079 > FactoryObjects;
00080 
00081 #endif /* #ifndef __FACTORYOBJECTS__H__ */
00082 
00083 /* End of file FactoryObjects.h */

Generated on Sun Apr 29 11:46:10 2007 for IPP/ICP2007 by  doxygen 1.4.7