1 #ifndef PDBCAL_BASE_PHGENERICFACTORYT_H
2 #define PDBCAL_BASE_PHGENERICFACTORYT_H
34 class AbstractProduct,
41 typedef AbstractProduct* (*ProductCreator)();
70 AbstractProduct*
create(
const char*
id)
77 typename CreatorMap::const_iterator
it =
83 return (it->second.creator())();
95 void print(std::ostream&
os = std::cout)
const
97 typename CreatorMap::const_iterator
it;
100 os <<
"Creator id=" << it->first
101 <<
" for product " << it->second.productname()
109 const char* productname)
115 std::cerr <<
"PHGenericFactoryT::registerCreator : registry of creator "
116 <<
"id " <<
id <<
" for product " << productname
117 <<
"failed!" << std::endl;
122 std::cout <<
"PHGenericFactoryT::registerCreator : creator id "
123 <<
id <<
" for product " << productname
124 <<
" registered." << std::endl;
144 typedef std::map<IdentifierType,ProductCreatorPair>
CreatorMap;