24 using namespace genie;
47 map<string, Algorithm *>::iterator alg_iter;
87 string key = name +
"/" + config;
90 <<
"Algorithm: " << key <<
" requested from AlgFactory";
92 map<string, Algorithm *>::const_iterator alg_iter =
fAlgPool.find(key);
93 bool found = (alg_iter !=
fAlgPool.end());
96 LOG(
"AlgFactory",
pDEBUG) << key <<
" algorithm found in memory";
97 return alg_iter->second;
104 pair<string, Algorithm *> key_alg_pair(key, alg_base);
108 <<
"Algorithm: " << key <<
" could not be instantiated";
134 <<
" ** Forcing algorithm re-configuration";
136 map<string, Algorithm *>::iterator alg_iter =
fAlgPool.begin();
137 for( ; alg_iter !=
fAlgPool.end(); ++alg_iter) {
139 bool reconfig = (ignore_alg_opt_out) ?
true : alg->
AllowReconfig();
142 bool skip_conf = (config==
"NoConfig" || config==
"");
158 LOG(
"AlgFactory",
pDEBUG) <<
"Instantiating algorithm = " << name;
160 TClass * tclass = gROOT->GetClass(name.c_str());
163 <<
"Failed instantiating algorithm = " << name;
166 void * vd_base = tclass->New();
171 LOG(
"AlgFactory",
pDEBUG) <<
"Setting Configuration Set = " << config;
173 bool skip_conf = (config==
"NoConfig" || config==
"");
175 LOG(
"AlgFactory",
pDEBUG) <<
"Skipping algorithm configuration step!";
185 string frame(100,
'.');
188 map<string, Algorithm *>::const_iterator alg_iter;
190 const Algorithm * alg = alg_iter->second;
191 stream << frame << endl;
192 stream <<
"Used algorithm: " << alg->
Id() << endl;
193 stream <<
"Printing config:";
200 stream << frame << endl;
201 stream <<
"Printing global parameters list:";
void Print(ostream &stream) const
print algorithm factory
A singleton class holding all configuration registries built while parsing all loaded XML configurati...
void DummyMethodAndSilentCompiler()
Algorithm abstract base class.
virtual const Registry & GetConfig(void) const
static AlgFactory * fInstance
sinleton's self
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
void ForceReconfiguration(bool ignore_alg_opt_out=false)
virtual void Configure(const Registry &config)
const Algorithm * GetAlgorithm(const AlgId &algid)
Algorithm * AdoptAlgorithm(const AlgId &algid) const
Registry * GlobalParameterList(void) const
Algorithm * InstantiateAlgorithm(string name, string config) const
Algorithm ID (algorithm name + configuration set name)
virtual const AlgId & Id(void) const
Get algorithm ID.
static AlgFactory * Instance()
virtual bool AllowReconfig(void) const
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
A registry. Provides the container for algorithm configuration parameters.
The GENIE Algorithm Factory.
map< string, Algorithm * > fAlgPool
'algorithm key' (namespace::name/config) -> 'algorithmic object' map
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
static AlgConfigPool * Instance()
string Config(void) const