#include <EvtModel.hh>
Public Member Functions | |
void | Register (EvtDecayBase *prototype) |
int | isModel (std::string name) |
EvtDecayBase * | getFcn (std::string model_name) |
int | isCommand (std::string cmd) |
void | storeCommand (std::string cmd, std::string cnfgstr) |
Static Public Member Functions | |
static EvtModel & | instance () |
Private Member Functions | |
EvtModel () | |
Private Attributes | |
std::map< std::string, EvtDecayBase * > | _modelNameHash |
std::map< std::string, EvtDecayBase * > | _commandNameHash |
Static Private Attributes | |
static EvtModel * | _instance = 0 |
Definition at line 34 of file EvtModel.hh.
EvtModel::EvtModel | ( | ) | [private] |
EvtDecayBase * EvtModel::getFcn | ( | std::string | model_name | ) |
Definition at line 46 of file EvtModel.cc.
References _modelNameHash, EvtDecayBase::clone(), calibUtil::ERROR, and report().
Referenced by EvtDecayTable::readDecayFile().
00046 { 00047 00048 EvtDecayBase *model=0; 00049 if ( _modelNameHash.find(model_name)!=_modelNameHash.end() ) { 00050 model=_modelNameHash[model_name]; 00051 } 00052 00053 if (model==0){ 00054 report(ERROR,"EvtGen") << "Did not find the right model:" 00055 <<model_name.c_str()<<"\n"; 00056 return 0; 00057 } 00058 00059 return model->clone(); 00060 00061 }
EvtModel & EvtModel::instance | ( | ) | [inline, static] |
Definition at line 63 of file EvtModel.hh.
References _instance.
Referenced by EvtModelReg::EvtModelReg(), and EvtDecayTable::readDecayFile().
int EvtModel::isCommand | ( | std::string | cmd | ) |
Definition at line 92 of file EvtModel.cc.
References _commandNameHash.
Referenced by EvtDecayTable::readDecayFile().
00092 { 00093 00094 if ( _commandNameHash.find(cmd)!=_commandNameHash.end() ) { 00095 return 1; 00096 } 00097 return 0; 00098 }
int EvtModel::isModel | ( | std::string | name | ) |
Definition at line 83 of file EvtModel.cc.
References _modelNameHash.
Referenced by EvtDecayTable::readDecayFile().
00083 { 00084 00085 if ( _modelNameHash.find(model_name)!=_modelNameHash.end() ) { 00086 return 1; 00087 } 00088 return 0; 00089 }
void EvtModel::Register | ( | EvtDecayBase * | prototype | ) |
Definition at line 64 of file EvtModel.cc.
References _commandNameHash, _modelNameHash, EvtDecayBase::commandName(), EvtDecayBase::getName(), and deljobs::string.
Referenced by EvtModelReg::EvtModelReg().
00064 { 00065 00066 std::string modelName; 00067 prototype->getName(modelName); 00068 00069 _modelNameHash[modelName]=prototype; 00070 00071 std::string commandName=prototype->commandName(); 00072 00073 if (commandName!=""){ 00074 00075 //report(DEBUG,"EvtGen") << "Adding command:"<<commandName<<endl; 00076 00077 _commandNameHash[commandName]=prototype; 00078 00079 } 00080 00081 }
void EvtModel::storeCommand | ( | std::string | cmd, | |
std::string | cnfgstr | |||
) |
Definition at line 100 of file EvtModel.cc.
References _commandNameHash, and EvtDecayBase::command().
Referenced by EvtDecayTable::readDecayFile().
00100 { 00101 00102 EvtDecayBase *model=0; 00103 if ( _commandNameHash.find(cmd)!=_commandNameHash.end() ) { 00104 model=_commandNameHash[cmd]; 00105 } 00106 00107 assert(model!=0); 00108 00109 model->command(cnfgstr); 00110 00111 }
std::map<std::string,EvtDecayBase*> EvtModel::_commandNameHash [private] |
Definition at line 57 of file EvtModel.hh.
Referenced by isCommand(), Register(), and storeCommand().
EvtModel * EvtModel::_instance = 0 [static, private] |
std::map<std::string,EvtDecayBase*> EvtModel::_modelNameHash [private] |