Nymph
v1.5.2
Flow-Based Data Processing Framework
|
Parses and stores command-line options. More...
#include <KTCommandLineHandler.hh>
Public Member Functions | |
const std::string & | GetExecutableName () const |
const std::string & | GetPackageString () const |
bool | ProcessCommandLine (int argC, char **argV) |
bool | TakeArguments (int argC, char **argV) |
bool | GetArgumentsTaken () |
int | GetNArgs () |
char ** | GetArgV () |
OptDescMapIt | CreateNewOptionGroup (const std::string &aTitle) |
Makes a new option group available for command line options. More... | |
bool | AddOption (const std::string &aTitle, const std::string &aHelpMsg, const std::string &aLongOpt, char aShortOpt, bool aWarnOnDuplicate=true) |
Simple option adding function, with short option (flag only; no values allowed) More... | |
bool | AddOption (const std::string &aTitle, const std::string &aHelpMsg, const std::string &aLongOpt, bool aWarnOnDuplicate=true) |
Simple option adding function, without short option (flag only; no values allowed) More... | |
template<class XValueType > | |
bool | AddOption (const std::string &aTitle, const std::string &aHelpMsg, const std::string &aLongOpt, char aShortOpt, bool aWarnOnDuplicate=true) |
Option-with-value adding function with short option. More... | |
template<class XValueType > | |
bool | AddOption (const std::string &aTitle, const std::string &aHelpMsg, const std::string &aLongOpt, bool aWarnOnDuplicate=true) |
Option-with-value adding function without short option. More... | |
po::options_description * | GetOptionsDescription (const std::string &aKey) |
Request access to the options description object for more freedom (and responsibility!) in adding options. More... | |
bool | FinalizeNewOptionGroups () |
Adds the groups of options to the set of usable options groups (note: this must be called to make the options in the groups usable) More... | |
void | InitialCommandLineProcessing () |
Parses the general options and stores the remaining options available for later parsing. More... | |
bool | DelayedCommandLineProcessing () |
Parses the remaining command line options (those that weren't parsed during the InitialCommandLineProcessing. More... | |
bool | IsCommandLineOptSet (const std::string &aCLOption) |
Check if a command line option was set. More... | |
template<class XReturnType > | |
XReturnType | GetCommandLineValue (const std::string &aCLOption) |
Return the value of a command line option; throws an exception if the value was not set. More... | |
template<class XReturnType > | |
XReturnType | GetCommandLineValue (const std::string &aCLOption, XReturnType defaultValue) |
Return the value of a command line option; returns the default if the value was not set. More... | |
bool | GetPrintHelpMessageFlag () const |
bool | GetPrintHelpMessageAfterConfigFlag () const |
bool | GetPrintVersionMessage () const |
const std::string & | GetConfigFilename () const |
Return the file name provided by the user on the command line for the config file. More... | |
const std::string & | GetCommandLineJSON () const |
Return the string of json provided by the user on the command line. More... | |
const po::parsed_options * | GetParsedOptions () const |
const po::variables_map * | GetVariablesMap () const |
const scarab::param_node * | GetConfigOverride () const |
virtual void | PrintHelpMessage () |
virtual void | PrintVersionMessage () |
Protected Types | |
typedef std::map< std::string, po::options_description *> | OptDescMap |
typedef OptDescMap::iterator | OptDescMapIt |
typedef OptDescMap::const_iterator | OptDescMapCIt |
Protected Member Functions | |
KTCommandLineHandler () | |
virtual | ~KTCommandLineHandler () |
bool | AddCommandLineOptions (const po::options_description &aSetOfOpts) |
Adds a set of command line options. More... | |
Protected Attributes | |
OptDescMap | fProposedGroups |
std::set< std::string > | fAllGroupKeys |
std::set< std::string > | fAllOptionsLong |
std::set< char > | fAllOptionsShort |
po::options_description | fCommandLineOptions |
po::options_description | fPrintHelpOptions |
Private Attributes | |
std::string | fExecutableName |
std::string | fPackageString |
int | fNArgs |
char ** | fArgV |
bool | fArgumentsTaken |
std::vector< std::string > | fCommandLineParseLater |
po::parsed_options | fParsedOptions |
po::variables_map | fCommandLineVarMap |
scarab::param_node | fConfigOverrideValues |
bool | fPrintHelpMessage |
bool | fPrintHelpMessageAfterConfig |
bool | fPrintVersionMessage |
std::string | fConfigFilename |
std::string | fCommandLineJSON |
Static Private Attributes | |
static const char | fDash = '-' |
static const char | fSeparator = '=' |
static const char | fNodeSeparator = '.' |
Friends | |
class | scarab::singleton< KTCommandLineHandler > |
class | scarab::destroyer< KTCommandLineHandler > |
Parses and stores command-line options.
The basic format for the command line arguments are as follows:
The configuration file will be automatically extracted from the command line. If –help (-h) or –version (-v) were given, those will be handled immediately, and the program will exit.
Definition at line 57 of file KTCommandLineHandler.hh.
|
protected |
Definition at line 60 of file KTCommandLineHandler.hh.
|
protected |
Definition at line 62 of file KTCommandLineHandler.hh.
|
protected |
Definition at line 61 of file KTCommandLineHandler.hh.
|
protected |
Definition at line 33 of file KTCommandLineHandler.cc.
|
protectedvirtual |
Definition at line 53 of file KTCommandLineHandler.cc.
|
protected |
Adds a set of command line options.
Definition at line 204 of file KTCommandLineHandler.cc.
bool AddOption | ( | const std::string & | aTitle, |
const std::string & | aHelpMsg, | ||
const std::string & | aLongOpt, | ||
char | aShortOpt, | ||
bool | aWarnOnDuplicate = true |
||
) |
Simple option adding function, with short option (flag only; no values allowed)
Definition at line 115 of file KTCommandLineHandler.cc.
bool AddOption | ( | const std::string & | aTitle, |
const std::string & | aHelpMsg, | ||
const std::string & | aLongOpt, | ||
bool | aWarnOnDuplicate = true |
||
) |
Simple option adding function, without short option (flag only; no values allowed)
Definition at line 153 of file KTCommandLineHandler.cc.
bool AddOption | ( | const std::string & | aTitle, |
const std::string & | aHelpMsg, | ||
const std::string & | aLongOpt, | ||
char | aShortOpt, | ||
bool | aWarnOnDuplicate = true |
||
) |
Option-with-value adding function with short option.
Definition at line 222 of file KTCommandLineHandler.hh.
bool AddOption | ( | const std::string & | aTitle, |
const std::string & | aHelpMsg, | ||
const std::string & | aLongOpt, | ||
bool | aWarnOnDuplicate = true |
||
) |
Option-with-value adding function without short option.
Definition at line 257 of file KTCommandLineHandler.hh.
KTCommandLineHandler::OptDescMapIt CreateNewOptionGroup | ( | const std::string & | aTitle | ) |
Makes a new option group available for command line options.
Definition at line 102 of file KTCommandLineHandler.cc.
bool DelayedCommandLineProcessing | ( | ) |
Parses the remaining command line options (those that weren't parsed during the InitialCommandLineProcessing.
Definition at line 233 of file KTCommandLineHandler.cc.
bool FinalizeNewOptionGroups | ( | ) |
Adds the groups of options to the set of usable options groups (note: this must be called to make the options in the groups usable)
Definition at line 189 of file KTCommandLineHandler.cc.
bool GetArgumentsTaken | ( | ) |
Definition at line 85 of file KTCommandLineHandler.cc.
char ** GetArgV | ( | ) |
Definition at line 95 of file KTCommandLineHandler.cc.
|
inline |
Return the string of json provided by the user on the command line.
Definition at line 310 of file KTCommandLineHandler.hh.
XReturnType GetCommandLineValue | ( | const std::string & | aCLOption | ) |
Return the value of a command line option; throws an exception if the value was not set.
Definition at line 284 of file KTCommandLineHandler.hh.
XReturnType GetCommandLineValue | ( | const std::string & | aCLOption, |
XReturnType | defaultValue | ||
) |
Return the value of a command line option; returns the default if the value was not set.
Definition at line 296 of file KTCommandLineHandler.hh.
|
inline |
Return the file name provided by the user on the command line for the config file.
Definition at line 305 of file KTCommandLineHandler.hh.
|
inline |
Definition at line 340 of file KTCommandLineHandler.hh.
|
inline |
Definition at line 212 of file KTCommandLineHandler.hh.
int GetNArgs | ( | ) |
Definition at line 90 of file KTCommandLineHandler.cc.
po::options_description * GetOptionsDescription | ( | const std::string & | aKey | ) |
Request access to the options description object for more freedom (and responsibility!) in adding options.
Definition at line 176 of file KTCommandLineHandler.cc.
|
inline |
Definition at line 216 of file KTCommandLineHandler.hh.
|
inline |
Definition at line 330 of file KTCommandLineHandler.hh.
|
inline |
Definition at line 325 of file KTCommandLineHandler.hh.
|
inline |
Definition at line 320 of file KTCommandLineHandler.hh.
|
inline |
Definition at line 315 of file KTCommandLineHandler.hh.
|
inline |
Definition at line 335 of file KTCommandLineHandler.hh.
void InitialCommandLineProcessing | ( | ) |
Parses the general options and stores the remaining options available for later parsing.
Definition at line 312 of file KTCommandLineHandler.cc.
bool IsCommandLineOptSet | ( | const std::string & | aCLOption | ) |
Check if a command line option was set.
Definition at line 226 of file KTCommandLineHandler.cc.
|
virtual |
Definition at line 435 of file KTCommandLineHandler.cc.
|
virtual |
Definition at line 444 of file KTCommandLineHandler.cc.
bool ProcessCommandLine | ( | int | argC, |
char ** | argV | ||
) |
Definition at line 74 of file KTCommandLineHandler.cc.
bool TakeArguments | ( | int | argC, |
char ** | argV | ||
) |
Definition at line 63 of file KTCommandLineHandler.cc.
|
friend |
Definition at line 70 of file KTCommandLineHandler.hh.
|
friend |
Definition at line 69 of file KTCommandLineHandler.hh.
|
protected |
Definition at line 131 of file KTCommandLineHandler.hh.
|
protected |
Definition at line 132 of file KTCommandLineHandler.hh.
|
protected |
Definition at line 133 of file KTCommandLineHandler.hh.
|
private |
Definition at line 101 of file KTCommandLineHandler.hh.
|
private |
Definition at line 100 of file KTCommandLineHandler.hh.
|
private |
Definition at line 201 of file KTCommandLineHandler.hh.
|
protected |
Definition at line 135 of file KTCommandLineHandler.hh.
|
private |
Definition at line 154 of file KTCommandLineHandler.hh.
|
private |
Definition at line 189 of file KTCommandLineHandler.hh.
|
private |
Definition at line 200 of file KTCommandLineHandler.hh.
|
private |
Definition at line 191 of file KTCommandLineHandler.hh.
|
staticprivate |
Definition at line 192 of file KTCommandLineHandler.hh.
|
private |
Definition at line 83 of file KTCommandLineHandler.hh.
|
private |
Definition at line 99 of file KTCommandLineHandler.hh.
|
staticprivate |
Definition at line 194 of file KTCommandLineHandler.hh.
|
private |
Definition at line 84 of file KTCommandLineHandler.hh.
|
private |
Definition at line 188 of file KTCommandLineHandler.hh.
|
private |
Definition at line 196 of file KTCommandLineHandler.hh.
|
private |
Definition at line 197 of file KTCommandLineHandler.hh.
|
protected |
Definition at line 136 of file KTCommandLineHandler.hh.
|
private |
Definition at line 198 of file KTCommandLineHandler.hh.
|
protected |
Definition at line 130 of file KTCommandLineHandler.hh.
|
staticprivate |
Definition at line 193 of file KTCommandLineHandler.hh.