EvtModel Class Reference

#include <EvtModel.hh>

List of all members.

Public Member Functions

void Register (EvtDecayBase *prototype)
int isModel (std::string name)
EvtDecayBasegetFcn (std::string model_name)
int isCommand (std::string cmd)
void storeCommand (std::string cmd, std::string cnfgstr)

Static Public Member Functions

static EvtModelinstance ()

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


Detailed Description

Definition at line 34 of file EvtModel.hh.


Constructor & Destructor Documentation

EvtModel::EvtModel (  )  [private]

Definition at line 42 of file EvtModel.cc.

00042                    {
00043 
00044 }


Member Function Documentation

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().

00063                                     {
00064   if ( _instance == 0 )  _instance=new EvtModel;
00065   return *_instance;
00066 }

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 }


Member Data Documentation

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]

Definition at line 54 of file EvtModel.hh.

Referenced by instance().

std::map<std::string,EvtDecayBase*> EvtModel::_modelNameHash [private]

Definition at line 56 of file EvtModel.hh.

Referenced by getFcn(), isModel(), and Register().


Generated on Tue Nov 29 23:19:07 2016 for BOSS_7.0.2 by  doxygen 1.4.7