Changeset View
Changeset View
Standalone View
Standalone View
src/EvtGenBase/EvtModel.cpp
Show All 32 Lines | |||||
#include <ctype.h> | #include <ctype.h> | ||||
#include <fstream> | #include <fstream> | ||||
#include <iomanip> | #include <iomanip> | ||||
#include <iostream> | #include <iostream> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string> | #include <string> | ||||
using std::fstream; | using std::fstream; | ||||
EvtModel* EvtModel::_instance = 0; | EvtModel* EvtModel::_instance = nullptr; | ||||
EvtModel::EvtModel() | EvtModel::EvtModel() | ||||
{ | { | ||||
} | } | ||||
EvtDecayBase* EvtModel::getFcn( std::string model_name ) | EvtDecayBase* EvtModel::getFcn( std::string model_name ) | ||||
{ | { | ||||
EvtDecayBase* model = 0; | EvtDecayBase* model = nullptr; | ||||
if ( _modelNameHash.find( model_name ) != _modelNameHash.end() ) { | if ( _modelNameHash.find( model_name ) != _modelNameHash.end() ) { | ||||
model = _modelNameHash[model_name]; | model = _modelNameHash[model_name]; | ||||
} | } | ||||
if ( model == 0 ) { | if ( model == nullptr ) { | ||||
EvtGenReport( EVTGEN_ERROR, "EvtGen" ) | EvtGenReport( EVTGEN_ERROR, "EvtGen" ) | ||||
<< "Did not find the right model:" << model_name.c_str() << "\n"; | << "Did not find the right model:" << model_name.c_str() << "\n"; | ||||
return 0; | return nullptr; | ||||
} | } | ||||
return model->clone(); | return model->clone(); | ||||
} | } | ||||
void EvtModel::registerModel( EvtDecayBase* prototype ) | void EvtModel::registerModel( EvtDecayBase* prototype ) | ||||
{ | { | ||||
std::string modelName = prototype->getName(); | std::string modelName = prototype->getName(); | ||||
Show All 20 Lines | int EvtModel::isCommand( std::string cmd ) | ||||
if ( _commandNameHash.find( cmd ) != _commandNameHash.end() ) { | if ( _commandNameHash.find( cmd ) != _commandNameHash.end() ) { | ||||
return 1; | return 1; | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
void EvtModel::storeCommand( std::string cmd, std::string cnfgstr ) | void EvtModel::storeCommand( std::string cmd, std::string cnfgstr ) | ||||
{ | { | ||||
EvtDecayBase* model = 0; | EvtDecayBase* model = nullptr; | ||||
if ( _commandNameHash.find( cmd ) != _commandNameHash.end() ) { | if ( _commandNameHash.find( cmd ) != _commandNameHash.end() ) { | ||||
model = _commandNameHash[cmd]; | model = _commandNameHash[cmd]; | ||||
} | } | ||||
assert( model != 0 ); | assert( model != 0 ); | ||||
model->command( cnfgstr ); | model->command( cnfgstr ); | ||||
} | } |