87 std::map<char,std::string>
_help;
93 std::vector<std::pair<std::string,int> >
_args;
134 std::string
GetRawComLine()
const {
return (_program_name+std::string(
" ")+_line);};
153 void Record(
const char *args[]);
163 void AddOption(
char s,
const std::string &l,
int = 0);
173 void AddOption(
char s,
const std::string &l,
int,
const std::string argname);
186 _args.push_back(std::make_pair(a,reqd));
207 void SetArgName(
const std::string opstr,
const std::string argname)
209 _argname[
GetShort(opstr)] = argname;
219 _argname[s] = argname;
227 void AddHelp(
char s,
const std::string &help){ _help[s] = help;};
234 void AddHelp(
const std::string &l,
const std::string &help)
248 std::string
GetHelp(
char s){
return(_help[s]);};
256 char GetShort(
const std::string &l);
260 std::string
GetLong(
const char &s);
291 std::string
GetOption(
const char &s){
return(_options[s]);};
322 void SetNotes(
const std::string ¬es){ _notes.assign(notes); };
326 void WriteRC(std::ostream &Ostr)
const;
330 void ReadRC(
const std::string &RCString);
334 template<
typename NumType>
337 if(!stinter.empty()){
338 std::string::size_type
x = stinter.find(
":");
339 std::string t1s = stinter;
340 std::string t2s = stinter;
341 if(x != std::string::npos){
342 t1s = stinter.substr(0,x);
343 t2s = stinter.substr(x+1);
345 std::istringstream Istr(t2s);
353 std::istringstream Istr(t1s);
357 std::istringstream Istr(t2s);
366 template<
typename NumType>
369 if(stinter ==
".true." || stinter ==
".TRUE."){
373 if(stinter ==
".false." || stinter ==
".FALSE."){
377 if(!stinter.empty()){
378 std::istringstream Istr(stinter);
void ReadRC(const std::string &RCString)
Read a config from RC string.
int ProcessOptions()
Processes all command line tokens.
std::string ErrorReport()
Error reporting.
std::string GetOption(const char &s)
Get the value of an option.
std::string GetLong(const char &s)
Obtain the long word option from the short char version.
void ProcessRange(NumType &t1, NumType &t2, const std::string stinter)
Process a range in the format "t1:t2".
std::string ProgramName() const
Program name access.
std::vector< std::pair< std::string, int > > _args
application arguments;
std::map< char, int > _type
stores the type of option
std::string GetHelp(const std::string &l)
Obtain the usage string for an option.
void SetArgName(const std::string opstr, const std::string argname)
Specify name of an option argument.
std::vector< std::string > _error_messages
stores error messages
void Copy(ComLineObject &incom)
Copy method.
virtual void UserInitialize(void)
virtual function for program specific Initialization.
std::map< std::string, std::string > _arghelp
help string for args
std::string GetOpStringByType(int mintype, int maxtype)
Obtains option strings by type.
ComLineObject(const char *args[])
Constructor.
void SetArgName(char s, const std::string &argname)
Specify name of an option argument.
std::string _line
unformatted command line
Defines MPI-specific parallel global and program classes.
std::map< char, std::string > _argname
stores a name for arguments
std::map< char, std::string > _help
stores the help string for each op
std::string GetOption(const std::string &l)
Get the value of an option.
int ProcessCommandLine(const char *args[])
One fell swoop processing of command line.
void const size_t const size_t const size_t const double const double * x
void AddHelp(const std::string &l, const std::string &help)
Specify usage for an option.
std::vector< std::string > GetArgs() const
Argument access.
std::string _description
application description.
void ResolveOption(NumType &t2, const std::string stinter)
Resolve an option (i.e.
void Record(const char *args[])
Minimal recording of command line.
friend std::ostream & operator<<(std::ostream &Out, const ComLineObject &cl)
void SetRawComLine(const std::string &incl)
Raw Command Line Access.
std::string _program_name
the name of the program
std::string GetHelp(char s)
Obtain the usage string for an option.
void SetDescription(const std::string &desc)
Set description string.
std::vector< std::string > _nonops
stores non-option arguments
std::string GetRawComLine() const
Raw Command Line Access.
void AddOption(char s, const std::string &l, int=0)
User interface to describe simple option.
void size_t int size_t int size_t int int int int double int int double double *void size_t int size_t int int int int int double int size_t size_t size_t double double *void size_t int size_t int size_t size_t int double int double double *void size_t size_t size_t double * a
std::vector< std::string > _toks
commandline tokens
friend std::istream & operator>>(std::istream &In, ComLineObject &cl)
std::map< char, std::string > _options
stores the value of each option
std::string LongUsage()
Generate long usage string.
virtual void Initialize(void)
virtual function for program specific Initialization.
void WriteRC(std::ostream &Ostr) const
Write an RC string that can be used for config.
void SetNotes(const std::string ¬es)
Set notes string.
void AddArgument(const std::string &a, int reqd=0)
User interface to describe an application argument.
std::string _notes
Notes to be displayed at the end of LongUsage().
char GetShort(const std::string &l)
Obtain the short one char option from the long word version.
ComLineObject()
Default constructor.
void AddHelp(char s, const std::string &help)
Specify usage for an option.
void AddArgHelp(const std::string &a, const std::string &help)
Specify the usage info for application argument.
std::string ShortUsage()
Generate short usage string.