50 MAP<string, arg_base*>::iterator it;
51 for (it = args.begin(); it != args.end(); it++) {
59 MAP<string, arg_base*>::iterator it;
60 for (it = args.begin(); it != args.end(); it++) {
61 if (defined_only && !(it->second->was_set()))
63 os <<
"# " << it->second->get_desc() <<
" (default value:";
64 it->second->write_parameters(os,
true);
66 os << it->second->get_name() <<
" ";
67 it->second->write_parameters(os);
88 cerr <<
"ERROR: " << __PRETTY_FUNCTION__ <<
" was not implemented yet" << endl;
96 prog_name = string(argv[0]);
102 string argn = string(argv[0]);
104 DEBUG_AL(
"parse_arguments: look for \"" << argn <<
"\"" << endl);
105 std::MAP<string,arg_base*>::const_iterator got = args.find(argn);
106 if (got == args.end()) {
107 cerr <<
"Error: could not find argument: " << argn << endl;
118 cerr <<
"WARNING: argument " << argp->
get_name() <<
" is being set more than once." << endl;
126 DEBUG_AL(
"parse_arguments: consumed " << consumed
127 <<
" parameters when parsing argument " 132 cerr <<
"Error when parsing parameters for argument: " << got->first << endl;
156 if (container == NULL)
166 if (container == NULL)
176 arg_base::arg_base(
const char* name,
const char* desc) :
177 arg_name (name), arg_desc (desc)
183 void values(ostream& os,
bool defined_only)
207 catch (...){
return 1;}
const string & get_name() const
void values(ostream &os, bool defined_only)
MAP< string, arg_base * > args
clarg::argInt cm("-cm", "clean memory before execution", 512)
virtual int parse_parameters(int argc, char *argv [])=0
int parse_arguments(int argc, char *argv[])
int parse_arguments(int argc, char *argv[])
int parse_arguments_from_file(std::istream &is)
void arguments_descriptions(ostream &os, string prefix, string suffix)
void list_arguments(ostream &os, bool defined_only)
int dump_arguments_to_file(ostream &of)
void register_argument(arg_base *arg)
args_container * get_container()
void arguments_descriptions(ostream &os, string prefix, string suffix)
int parse_arguments_from_file(std::istream &is)
const string & get_desc() const
static args_container * container