26 #ifndef ROOT_TMVA_ClassifierFactory
27 #define ROOT_TMVA_ClassifierFactory
80 const TString& weightfile =
"" );
82 const std::vector<std::string>
List()
const;
100 typedef std::map<std::string, Creator>
CallMap;
126 #define REGISTER_METHOD(CLASS) \
129 struct RegisterTMVAMethod { \
130 static TMVA::IMethod* CreateMethod##CLASS(const TString& job, const TString& title, TMVA::DataSetInfo& dsi, const TString& option) \
132 if(job=="" && title=="") { \
133 return (TMVA::IMethod*) new TMVA::Method##CLASS(dsi, option); \
135 return (TMVA::IMethod*) new TMVA::Method##CLASS(job, title, dsi, option); \
138 RegisterTMVAMethod() { \
139 TMVA::ClassifierFactory::Instance(). Register(#CLASS, CreateMethod##CLASS); \
140 TMVA::Types::Instance().AddTypeMapping(TMVA::Types::k##CLASS, #CLASS); \
143 static RegisterTMVAMethod RegisterTMVAMethod_instance; \
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
std::map< std::string, Creator > CallMap
static ClassifierFactory * fgInstance
Initialize static singleton pointer.
IMethod *(* Creator)(const TString &job, const TString &title, DataSetInfo &dsi, const TString &option)
const ClassifierFactory & operator=(const ClassifierFactory &)
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
Bool_t Register(const std::string &name, Creator creator)
registers a classifier creator function under the method type name
Abstract ClassifierFactory template that handles arbitrary types.
const std::vector< std::string > List() const
returns a vector of the method type names of registered methods