Added a prefix data in eoParser - and the setPrefix method -

for multi-population parameter input. Now you can call the make_xxx
functions from teh src/do directory several times for different populations
provided you do different calls to setPrefix inbetween
This commit is contained in:
evomarc 2004-04-05 15:28:12 +00:00
commit 87ddb6f8b5
2 changed files with 18 additions and 2 deletions

View file

@ -125,7 +125,7 @@ eoParam* eoParser::getParamWithLongName(std::string _name)
typedef MultiMapType::const_iterator It;
for (It p = params.begin(); p != params.end(); ++p)
{
if (p->second->longName() == _name)
if (p->second->longName() == prefix+_name)
return p->second;
}
return 0;
@ -161,6 +161,13 @@ eoValueParam<ValueType>& eoParser::getORcreateParam (
void eoParser::processParam(eoParam& param, std::string section)
{
// this param enters the parser: add the prefix to the long name
if (prefix != "")
{
param.setLongName(prefix+param.longName());
section = prefix + section; // and to section
}
doRegisterParam(param); // plainly register it
params.insert(make_pair(section, &param));
}

View file

@ -24,7 +24,7 @@
*/
//-----------------------------------------------------------------------------
/**
CVS Info: $Date: 2003-02-27 19:21:17 $ $Version$ $Author: okoenig $
CVS Info: $Date: 2004-04-05 15:28:12 $ $Version$ $Author: evomarc $
*/
#ifndef eoParser_h
#define eoParser_h
@ -189,6 +189,12 @@ public:
void setStopOnUnknownParam(bool _b) {stopOnUnknownParam.value()=_b;}
bool getStopOnUnknownParam() {return stopOnUnknownParam.value();}
/** Prefix handling */
void setPrefix(const std:: string & _prefix) {prefix = _prefix;}
void resetPrefix() {prefix = "";}
std::string getPrefix() {return prefix;}
private:
@ -216,6 +222,9 @@ private:
eoValueParam<bool> stopOnUnknownParam;
mutable std::vector<std::string> messages;
std::string prefix; // used for all created params - in processParam
};