Go to the documentation of this file.
14 #ifndef FACTORY_INCLUDED
15 #define FACTORY_INCLUDED
41 template<
class AbstractProduct,
typename ProductCreator>
45 typedef std::map<IdentifierType, ProductCreator>
Map;
61 typename Map::const_iterator i =
m_map.find(subtype);
62 if (i !=
m_map.end()) {
65 fprintf(stderr,
"Factory::find: unknown type \"%s\"\n", subtype.c_str());
76 m_map.insert(
typename Map::value_type(subtype, creator)).second) {
79 fprintf(stderr,
"Factory::append: duplicate key \"%s\"\n", subtype.c_str());
123 for (
typename Map::const_iterator p =
m_map.begin(); p !=
m_map.end(); ++p) {
129 static void print(
const char *tag = NULL)
137 template<
class AbstractProduct,
typename ProductCreator>
void show_entries(const char *tag)
virtual ~FactoryTemplate()
static FactoryTemplate & Instance()
static FactoryTemplate * s_instance
std::map< IdentifierType, ProductCreator > Map
static ProductCreator Find(const IdentifierType &subtype)
FactoryTemplate & operator=(const FactoryTemplate &)
ProductCreator find(const IdentifierType &subtype)
static bool Register(const IdentifierType &subtype, ProductCreator creator)
bool append(const IdentifierType &subtype, ProductCreator creator)
static void print(const char *tag=NULL)
FactoryTemplate(const FactoryTemplate &)
static void create_instance()
void general(const char *format,...)
std::string IdentifierType