60 if (fgInstance!=0)
delete fgInstance;
68 if(fCalls.find(name) != fCalls.end())
70 std::cerr <<
"ClassifierFactory<>::Register - " << name <<
" already exists" << std::endl;
74 return fCalls.insert(CallMap::value_type(name, creator)).second;
82 return fCalls.erase(name) == 1;
98 CallMap::const_iterator it = fCalls.find(name);
101 if (it == fCalls.end()) {
102 std::cerr <<
"ClassifierFactory<>::Create - don't know anything about " << name << std::endl;
106 return (it->second)(job,
title, dsi, option);
120 CallMap::const_iterator it = fCalls.find(name);
123 if (it == fCalls.end()) {
124 std::cerr <<
"ClassifierFactory<>::Create - don't know anything about " << name << std::endl;
128 return (it->second)(
"",
"", dsi, weightfile);
136 std::vector<std::string> svec;
138 CallMap::const_iterator it = fCalls.begin();
139 for (; it != fCalls.end(); ++it) svec.push_back(it ->
first);
149 std::cout <<
"Print: ClassifierFactory<> knows about " << fCalls.size() <<
" objects" << std::endl;
151 CallMap::const_iterator it = fCalls.begin();
152 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
static ClassifierFactory * fgInstance
Initialize static singleton pointer.
static void DestroyInstance()
destroy the singleton instance
Bool_t Unregister(const std::string &name)
unregisters a classifier type name
void Print() const
prints the registered method type names
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
Bool_t Register(const std::string &name, Creator creator)
registers a classifier creator function under the method type name
const std::vector< std::string > List() const
returns a vector of the method type names of registered methods