65 std::cerr <<
"ClassifierFactory<>::Register - " << name <<
" already exists" << std::endl;
69 return fCalls.insert(CallMap::value_type(name, creator)).second;
77 return fCalls.erase(name) == 1;
93 CallMap::const_iterator it =
fCalls.find(name);
97 std::cerr <<
"ClassifierFactory<>::Create - don't know anything about " << name << std::endl;
101 return (it->second)(job, title, dsi, option);
115 CallMap::const_iterator it =
fCalls.find(name);
119 std::cerr <<
"ClassifierFactory<>::Create - don't know anything about " << name << std::endl;
123 return (it->second)(
"",
"", dsi, weightfile);
131 std::vector<std::string> svec;
133 CallMap::const_iterator it =
fCalls.begin();
134 for (; it !=
fCalls.end(); ++it) svec.push_back(it -> first);
144 std::cout <<
"Print: ClassifierFactory<> knows about " <<
fCalls.size() <<
" objects" << std::endl;
146 CallMap::const_iterator it =
fCalls.begin();
147 for (; it !=
fCalls.end(); ++it) std::cout <<
"Registered object name " << it -> first << std::endl;
IMethod * Create(const std::string &name, const TString &job, const TString &title, DataSetInfo &dsi, const TString &option)
creates the method if needed based on the method name using the creator function the factory has stor...
static ClassifierFactory & Instance()
access to the ClassifierFactory singleton creates the instance if needed
const std::vector< std::string > List() const
returns a vector of the method type names of registered methods
static ClassifierFactory * fgInstance
Initialize static singleton pointer.
IMethod *(* Creator)(const TString &job, const TString &title, DataSetInfo &dsi, const TString &option)
static void DestroyInstance()
destroy the singleton instance
void Print() const
prints the registered method type names
Bool_t Unregister(const std::string &name)
unregisters a classifier type name
Bool_t Register(const std::string &name, Creator creator)
registers a classifier creator function under the method type name