Turned the code that was testing for the existence of the size parameter

in to the call to getORcreateParam (actually, this was where this code
has been tested the first time)
This commit is contained in:
evomarc 2002-04-26 02:39:10 +00:00
commit 25a4894853

View file

@ -61,19 +61,8 @@ template <class EOT>
eoInit<EOT> & do_make_genotype(eoParser& _parser, eoState& _state, EOT)
{
// for bitstring, only thing needed is the size
unsigned theSize;
// but it might have been already read in the definition fo the performance
eoParam* ptParam = _parser.getParamWithLongName(string("chromSize"));
if (!ptParam) // not already defined: read it here
{
theSize = _parser.createParam(unsigned(10), "chromSize", "The length of the bitstrings", 'n',"Problem").value();
}
else // it was read before, get its value
{
eoValueParam<unsigned>* ptChromSize = dynamic_cast<eoValueParam<unsigned>*>(ptParam);
theSize = ptChromSize->value();
}
unsigned theSize = _parser.getORcreateParam(unsigned(10), "chromSize", "The length of the bitstrings", 'n',"Problem").value();
// Then we can built a bitstring random initializer
// based on boolean_generator class (see utils/rnd_generator.h)