Some changes in names, before too many users have to modify their code :-)
Changed es.h in src/es into make_es.h (was ambiguous with src/es.h) Changed the interface of make_genotype - now templatized by the EOT and not the fitness - this is mandatory for ES genoptypes as it allows to choose the type of gentype at run-time (from existing types, of course!) Also moved make_help.cpp into utils dir (otherwise you'd had to maintain a copy into each representation dir!).
This commit is contained in:
parent
d90286d890
commit
5bea22e876
1 changed files with 62 additions and 0 deletions
62
eo/src/utils/make_help.cpp
Normal file
62
eo/src/utils/make_help.cpp
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// make_help.h
|
||||
// (c) Maarten Keijzer, Marc Schoenauer and GeNeura Team, 2001
|
||||
/*
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||
Marc.Schoenauer@polytechnique.fr
|
||||
mkeijzer@dhi.dk
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
#include <utils/eoParser.h>
|
||||
#include <fstream.h>
|
||||
|
||||
/** Generation of the status file, and output of the help message if needed
|
||||
*
|
||||
* MUST be called after ALL parameters have been read in order to list them
|
||||
*
|
||||
* Warning: this is a plain .cpp file and shoudl NOT be included anywhere,
|
||||
* but compiled separately and stored in a library.
|
||||
*
|
||||
* It is declared in all make_xxx.h files in representation-dependent dirs
|
||||
* but it is NOT representation-dependent itself - that's why it's in utils
|
||||
*/
|
||||
void make_help(eoParser & _parser)
|
||||
{
|
||||
// name of the "status" file where all actual parameter values will be saved
|
||||
string str_status = _parser.ProgramName() + ".status"; // default value
|
||||
eoValueParam<string>& statusParam = _parser.createParam(str_status, "status","Status file",'\0', "Persistence" );
|
||||
|
||||
// dump status file BEFORE help, so the user gets a chance to use it:
|
||||
// it's probably the case where she/he needs it most!!!
|
||||
// Only help parameter will not be in status file - but who cares???
|
||||
if (statusParam.value() != "")
|
||||
{
|
||||
ofstream os(statusParam.value().c_str());
|
||||
os << _parser; // and you can use that file as parameter file
|
||||
}
|
||||
// do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED
|
||||
// i.e. in case you need parameters somewhere else, postpone these
|
||||
if (_parser.userNeedsHelp())
|
||||
{
|
||||
_parser.printHelp(cout);
|
||||
cout << "You can use an edited copy of file " << statusParam.value()
|
||||
<< " as parameter file" << endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
Reference in a new issue