OpenASIP
2.0
|
#include <CmdLineOptions.hh>
Public Member Functions | |
CmdLineOptions (std::string description, std::string version="") | |
virtual | ~CmdLineOptions () |
void | parse (char *argv[], int argc) |
void | parse (std::string argv[], int argc) |
void | parse (std::vector< std::string > argv) |
virtual void | printHelp () const |
virtual void | printVersion () const =0 |
virtual bool | isVerboseSwitchDefined () const |
virtual bool | isVerboseSpamSwitchDefined () const |
Public Member Functions inherited from CmdLineParser | |
CmdLineParser (std::string description) | |
virtual | ~CmdLineParser () |
virtual void | storeOptions (Options &options) |
virtual int | numberOfArguments () const |
virtual std::string | argument (int index) const |
Protected Member Functions | |
bool | optionGiven (std::string key) const |
Protected Member Functions inherited from CmdLineParser | |
void | addOption (CmdLineOptionParser *opt) |
CmdLineOptionParser * | findOption (std::string name) const |
bool | parseOption (std::string option, std::string &name, std::string &arguments, std::string &prefix, bool &hasArgument) const |
bool | readPrefix (std::string &option, std::string &prefix, bool &longOption) const |
bool | isPrefix (std::string name) const |
Private Types | |
typedef std::map< std::string, CmdLineOptionParser * >::value_type | valType |
For adding new values to maps. More... | |
typedef std::map< std::string, CmdLineOptionParser * >::iterator | mapIter |
For traversing non-const maps. More... | |
typedef std::map< std::string, CmdLineOptionParser * >::const_iterator | constMapIter |
For traversing const maps. More... | |
Private Member Functions | |
CmdLineOptions (const CmdLineOptions &) | |
Copying not allowed. More... | |
CmdLineOptions & | operator= (const CmdLineOptions &) |
Assignment not allowed. More... | |
void | parseAll () |
Private Attributes | |
std::string | progName_ |
The name of the program. More... | |
std::string | description_ |
The description of usage of program. More... | |
std::string | version_ |
The version of the program. More... | |
Static Private Attributes | |
static const int | SHORT_FLAG = 2 |
Number of characters reserved for printing short version of commandline flag. More... | |
static const int | LONG_FLAG = 22 |
Number of characters reserved for printing long version of commandline flag. More... | |
static const std::string | VERBOSE_SWITCH = "verbose" |
Switch for verbose output listing scheduler modules. More... | |
static const std::string | VERBOSE_SPAM_SWITCH = "verbose_spam" |
Switch for verbose output listing spam from scheduler internals. More... | |
Additional Inherited Members | |
Protected Attributes inherited from CmdLineParser | |
std::map< std::string, CmdLineOptionParser * > | optionLongNames_ |
Database for holding options with their long names as a key. More... | |
std::map< std::string, CmdLineOptionParser * > | optionShortNames_ |
Database for holding options with their short names as a key. More... | |
std::vector< std::string > | commandLine_ |
Command line is stored here. More... | |
std::vector< std::string > | arguments_ |
Command line arguments are stored here. More... | |
std::vector< std::string > | prefixes_ |
Legal prefixes are stored here. More... | |
Abstract base class for command line parsers.
Is capable of storing and parsing commmand line options.
Definition at line 54 of file CmdLineOptions.hh.
|
private |
For traversing const maps.
Definition at line 77 of file CmdLineOptions.hh.
|
private |
For traversing non-const maps.
Definition at line 74 of file CmdLineOptions.hh.
|
private |
For adding new values to maps.
Definition at line 72 of file CmdLineOptions.hh.
CmdLineOptions::CmdLineOptions | ( | std::string | description, |
std::string | version = "" |
||
) |
Constructor.
description | Brief description of the program and how to use it. Only prefix is currently "no-". |
Definition at line 73 of file CmdLineOptions.cc.
References CmdLineParser::addOption(), VERBOSE_SPAM_SWITCH, and VERBOSE_SWITCH.
|
virtual |
|
private |
Copying not allowed.
|
virtual |
Return true if the verbose spam switch was defined in the command line.
Definition at line 310 of file CmdLineOptions.cc.
References CmdLineParser::findOption(), CmdLineOptionParser::isDefined(), and VERBOSE_SPAM_SWITCH.
Referenced by GenerateProcessor::generateProcessor(), main(), and Application::setCmdLineOptions().
|
virtual |
Return true if the verbose switch was defined in the command line.
Reimplemented in LLVMTCECmdLineOptions.
Definition at line 300 of file CmdLineOptions.cc.
References CmdLineParser::findOption(), CmdLineOptionParser::isDefined(), and VERBOSE_SWITCH.
Referenced by GenerateProcessor::generateProcessor(), main(), Application::setCmdLineOptions(), and llvm::LLVMTCEIRBuilder::~LLVMTCEIRBuilder().
|
private |
Assignment not allowed.
|
protected |
Returns true if there is a value available for given option.
Definition at line 320 of file CmdLineOptions.cc.
References CmdLineParser::findOption(), and CmdLineOptionParser::isDefined().
Referenced by SimulatorCmdLineOptions::backendType(), SimulatorCmdLineOptions::debugMode(), SchedulerCmdLineOptions::dumpIfConversionCFGs(), SchedulerCmdLineOptions::enableOffsetAA(), SchedulerCmdLineOptions::enableStackAA(), SchedulerCmdLineOptions::killDeadResults(), SchedulerCmdLineOptions::printResourceConstraints(), SchedulerCmdLineOptions::renameRegisters(), and SimulatorCmdLineOptions::scriptString().
|
virtual |
Loads all command line arguments and parses them.
options | Command line options pre-parsed in char* array. |
argc | The number of command line options. |
IllegalCommandLine | If parsing is not succesfull. |
ParserStopRequest | If help or version option is found. |
Reimplemented from CmdLineParser.
Definition at line 107 of file CmdLineOptions.cc.
References CmdLineParser::commandLine_, parseAll(), and progName_.
Referenced by GenerateProcessor::generateProcessor(), llvm::LLVMTCEScheduler::LLVMTCEScheduler(), and main().
void CmdLineOptions::parse | ( | std::string | argv[], |
int | argc | ||
) |
Loads all command line arguments and parses them.
options | Command line options pre-parsed in string array. |
argc | The number of command line options. |
IllegalCommandLine | If parsing is not succesfull. |
ParserStopRequest | If help or version option is found. |
Definition at line 128 of file CmdLineOptions.cc.
References CmdLineParser::commandLine_, parseAll(), and progName_.
|
virtual |
Loads all command line arguments and parses them.
options | Command line options pre-parsed in string vector. |
IllegalCommandLine | If parsing is not succesfull. |
ParserStopRequest | If help or version option is found. |
Reimplemented from CmdLineParser.
Definition at line 147 of file CmdLineOptions.cc.
References CmdLineParser::commandLine_, parseAll(), and progName_.
|
private |
Parses all command line options.
IllegalCommandLine | If parsing fails. |
ParserStopRequest | The client should not proceed. |
Definition at line 165 of file CmdLineOptions.cc.
References CmdLineParser::arguments_, CmdLineParser::commandLine_, CmdLineParser::findOption(), CmdLineParser::parseOption(), CmdLineOptionParser::parseValue(), printHelp(), and printVersion().
Referenced by parse().
|
virtual |
Prints the help menu of the program.
Reimplemented in OsalCmdLineOptions, ProGeCmdLineOptions, PIGCmdLineOptions, TestHDBCmdLineOptions, TTAUnitTesterCmdLineOptions, ExplorerCmdLineOptions, SimulatorCmdLineOptions, BEMGeneratorCmdLineOptions, EstimatorCmdLineOptions, CreateHDBCmdLineOptions, BEMViewerCmdLineOptions, and MachInfoCmdLineOptions.
Definition at line 262 of file CmdLineOptions.cc.
References CmdLineOptionParser::description(), description_, CmdLineParser::findOption(), CmdLineOptionParser::isHidden(), LONG_FLAG, CmdLineOptionParser::longName(), CmdLineParser::optionLongNames_, SHORT_FLAG, and CmdLineOptionParser::shortName().
Referenced by parseAll(), MachInfoCmdLineOptions::printHelp(), EstimatorCmdLineOptions::printHelp(), CreateHDBCmdLineOptions::printHelp(), BEMGeneratorCmdLineOptions::printHelp(), SimulatorCmdLineOptions::printHelp(), ExplorerCmdLineOptions::printHelp(), TTAUnitTesterCmdLineOptions::printHelp(), TestHDBCmdLineOptions::printHelp(), PIGCmdLineOptions::printHelp(), and ProGeCmdLineOptions::printHelp().
|
pure virtual |
Implemented in OsalCmdLineOptions, DumperCmdLineOptions, DictionaryToolCmdLineOptions, DisasmCmdLineOptions, DisasmCmdLineOptions, LLVMTCECmdLineOptions, ProGeCmdLineOptions, AsmCmdLineOptions, PIGCmdLineOptions, TestHDBCmdLineOptions, TTAUnitTesterCmdLineOptions, ExplorerCmdLineOptions, SchedulerCmdLineOptions, SimulatorCmdLineOptions, BEMGeneratorCmdLineOptions, EstimatorCmdLineOptions, CreateHDBCmdLineOptions, BEMViewerCmdLineOptions, BuildOpsetOptions, and MachInfoCmdLineOptions.
Referenced by parseAll().
|
private |
The description of usage of program.
Definition at line 89 of file CmdLineOptions.hh.
Referenced by printHelp().
|
staticprivate |
Number of characters reserved for printing long version of commandline flag.
Definition at line 99 of file CmdLineOptions.hh.
Referenced by printHelp().
|
private |
|
staticprivate |
Number of characters reserved for printing short version of commandline flag.
Definition at line 95 of file CmdLineOptions.hh.
Referenced by printHelp().
|
staticprivate |
Switch for verbose output listing spam from scheduler internals.
Definition at line 105 of file CmdLineOptions.hh.
Referenced by CmdLineOptions(), and isVerboseSpamSwitchDefined().
|
staticprivate |
Switch for verbose output listing scheduler modules.
Definition at line 102 of file CmdLineOptions.hh.
Referenced by CmdLineOptions(), and isVerboseSwitchDefined().
|
private |
The version of the program.
Definition at line 91 of file CmdLineOptions.hh.