OpenASIP  2.0
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CmdLineOptionParser Class Referenceabstract

#include <CmdLineOptionParser.hh>

Inheritance diagram for CmdLineOptionParser:
Inheritance graph
Collaboration diagram for CmdLineOptionParser:
Collaboration graph

Public Member Functions

 CmdLineOptionParser (std::string name, std::string desc, std::string alias, bool hidden=false)
 
virtual ~CmdLineOptionParser ()
 
virtual OptionValuecopy () const =0
 
std::string longName () const
 
std::string shortName () const
 
std::string description () const
 
virtual bool parseValue (std::string arguments, std::string prefix)=0
 Pure virtual function that parses the value of option. More...
 
bool isHidden ()
 
bool isDefined ()
 
virtual int integer (int index=0) const
 
virtual unsigned unsignedInteger (int index=0) const
 
virtual std::string String (int index=0) const
 
virtual double real () const
 
virtual bool isFlagOn () const
 
virtual bool isFlagOff () const
 
virtual int listSize () const
 

Protected Member Functions

void setDefined ()
 

Private Member Functions

 CmdLineOptionParser (const CmdLineOptionParser &)
 Copying not allowed. More...
 
CmdLineOptionParseroperator= (const CmdLineOptionParser &)
 Assignment not allowed. More...
 

Private Attributes

std::string longName_
 The full name of an option. More...
 
std::string shortName_
 The optional alias (shorter name). More...
 
std::string desc_
 The description of option. More...
 
bool hidden_ = false
 The hidden flag. If set, no entry is printed in the normal help text. More...
 
bool defined_
 Is the value of this option set in the parsed command line? More...
 

Detailed Description

Abstract base class for modeling command line options and their built-in mini-parser.

All option types have a set of properties that identify the option: name, description and short name (alias). Possible concrete types of options are: Boolean, real, integer, and character string.

Definition at line 56 of file CmdLineOptionParser.hh.

Constructor & Destructor Documentation

◆ CmdLineOptionParser() [1/2]

CmdLineOptionParser::CmdLineOptionParser ( std::string  name,
std::string  desc,
std::string  alias,
bool  hidden = false 
)

Constructor.

Parameters
nameThe name of the option.
descThe description of the option.
aliasThe short name of the option.

Definition at line 62 of file CmdLineOptionParser.cc.

66  :
67  longName_(name), shortName_(alias), desc_(desc), hidden_(hidden),
68  defined_(false) {
69 }

◆ ~CmdLineOptionParser()

CmdLineOptionParser::~CmdLineOptionParser ( )
virtual

Destructor.

Definition at line 74 of file CmdLineOptionParser.cc.

74  {
75 }

◆ CmdLineOptionParser() [2/2]

CmdLineOptionParser::CmdLineOptionParser ( const CmdLineOptionParser )
private

Copying not allowed.

Member Function Documentation

◆ copy()

virtual OptionValue* CmdLineOptionParser::copy ( ) const
pure virtual

◆ description()

std::string CmdLineOptionParser::description ( ) const

◆ integer()

int CmdLineOptionParser::integer ( int  index = 0) const
virtual

◆ isDefined()

bool CmdLineOptionParser::isDefined ( )

Returns true if the option was defined in the command line.

Returns
True if the option was defined in the command line.

Definition at line 169 of file CmdLineOptionParser.cc.

169  {
170  return defined_;
171 }

References defined_.

Referenced by ExplorerCmdLineOptions::adfFile(), ExplorerCmdLineOptions::adfOutFile(), LLVMTCECmdLineOptions::analyzeInstructionPatterns(), LLVMTCECmdLineOptions::assumeADFStackAlignment(), ExplorerCmdLineOptions::compilerOptions(), PIGCmdLineOptions::dataMemoryWidthInMAUs(), LLVMTCECmdLineOptions::disableAddressSpaceAA(), LLVMTCECmdLineOptions::disableDelaySlotFiller(), LLVMTCECmdLineOptions::disableHWLoops(), LLVMTCECmdLineOptions::disableLLVMAA(), LLVMTCECmdLineOptions::dumpDDGsDot(), LLVMTCECmdLineOptions::dumpDDGsXML(), ExplorerCmdLineOptions::idfFile(), LLVMTCECmdLineOptions::isDataStartAddressSet(), TestHDBCmdLineOptions::isFUEntryIDGiven(), LLVMTCECmdLineOptions::isInitialStackPointerValueSet(), SchedulerCmdLineOptions::isLoopOptDefined(), SchedulerCmdLineOptions::isMachineFileDefined(), LLVMTCECmdLineOptions::isOptLevelDefined(), SchedulerCmdLineOptions::isOutputFileDefined(), TestHDBCmdLineOptions::isRFEntryIDGiven(), LLVMTCECmdLineOptions::isStandardEmulationLibDefined(), CmdLineOptions::isVerboseSpamSwitchDefined(), LLVMTCECmdLineOptions::isVerboseSwitchDefined(), CmdLineOptions::isVerboseSwitchDefined(), LLVMTCECmdLineOptions::isWorkItemAAFileDefined(), DumperCmdLineOptions::onlyLogicalInfo(), CmdLineOptions::optionGiven(), DisasmCmdLineOptions::outputFileDefined(), DumperCmdLineOptions::printFileHeaders(), DumperCmdLineOptions::printMemoryInfo(), DumperCmdLineOptions::printRelocations(), DumperCmdLineOptions::printSectionHeaders(), ExplorerCmdLineOptions::printSummary(), DumperCmdLineOptions::printSymbols(), LLVMTCECmdLineOptions::saveBackendPlugin(), SchedulerCmdLineOptions::schedulingWindowSize(), LLVMTCECmdLineOptions::useBubbleFish2Scheduler(), LLVMTCECmdLineOptions::useBUScheduler(), LLVMTCECmdLineOptions::useOldBackendSources(), SchedulerCmdLineOptions::useRestrictedAliasAnalyzer(), LLVMTCECmdLineOptions::useTDScheduler(), LLVMTCECmdLineOptions::useVectorBackend(), and ExplorerCmdLineOptions::writeOutBestConfiguration().

◆ isFlagOff()

bool CmdLineOptionParser::isFlagOff ( ) const
virtual

This implementation should never be called.

Returns
Nothing.
Exceptions
WrongSubclassCalled for a wrong subclass.

Reimplemented in BoolCmdLineOptionParser, and OptionalStringCmdLineOptionParser.

Definition at line 138 of file CmdLineOptionParser.cc.

138  {
139  throw WrongSubclass(__FILE__, __LINE__, __func__);
140  return false;
141 }

References __func__.

◆ isFlagOn()

bool CmdLineOptionParser::isFlagOn ( ) const
virtual

This implementation should never be called.

Returns
Nothing.
Exceptions
WrongSubclassCalled for a wrong subclass.

Reimplemented in BoolCmdLineOptionParser, and OptionalStringCmdLineOptionParser.

Definition at line 126 of file CmdLineOptionParser.cc.

126  {
127  throw WrongSubclass(__FILE__, __LINE__, __func__);
128  return false;
129 }

References __func__.

Referenced by ProGeCmdLineOptions::asyncReset(), SimulatorCmdLineOptions::backendType(), SimulatorCmdLineOptions::debugMode(), SchedulerCmdLineOptions::dumpIfConversionCFGs(), SchedulerCmdLineOptions::enableOffsetAA(), SchedulerCmdLineOptions::enableStackAA(), DisasmCmdLineOptions::flatFile(), ProGeCmdLineOptions::forceOutputDirectory(), PIGCmdLineOptions::generateDataImages(), PIGCmdLineOptions::generateDecompressor(), ProGeCmdLineOptions::generateTestbench(), BuildOpsetOptions::ignore(), SchedulerCmdLineOptions::killDeadResults(), TTAUnitTesterCmdLineOptions::leaveDirty(), TestHDBCmdLineOptions::leaveDirty(), DisasmCmdLineOptions::lineNumbers(), ProGeCmdLineOptions::listAvailableIntegrators(), EstimatorCmdLineOptions::longestPath(), ExplorerCmdLineOptions::numberOfConfigurations(), ProGeCmdLineOptions::preferHDLGeneration(), ExplorerCmdLineOptions::printApplications(), ExplorerCmdLineOptions::printPlugins(), SchedulerCmdLineOptions::printResourceConstraints(), DisasmCmdLineOptions::printToStdout(), SchedulerCmdLineOptions::renameRegisters(), ProGeCmdLineOptions::resetAllRegisters(), LLVMTCECmdLineOptions::saveBackendPlugin(), PIGCmdLineOptions::showCompressors(), ProGeCmdLineOptions::syncReset(), EstimatorCmdLineOptions::totalArea(), EstimatorCmdLineOptions::totalEnergy(), ProGeCmdLineOptions::useAbsolutePaths(), TTAUnitTesterCmdLineOptions::verbose(), and TestHDBCmdLineOptions::verbose().

◆ isHidden()

bool CmdLineOptionParser::isHidden ( )
inline

Definition at line 75 of file CmdLineOptionParser.hh.

75 { return hidden_; }

References hidden_.

Referenced by CmdLineOptions::printHelp().

◆ listSize()

int CmdLineOptionParser::listSize ( ) const
virtual

◆ longName()

std::string CmdLineOptionParser::longName ( ) const

◆ operator=()

CmdLineOptionParser& CmdLineOptionParser::operator= ( const CmdLineOptionParser )
private

Assignment not allowed.

◆ parseValue()

virtual bool CmdLineOptionParser::parseValue ( std::string  arguments,
std::string  prefix 
)
pure virtual

◆ real()

double CmdLineOptionParser::real ( ) const
virtual

This implementation should never be called.

Returns
Nothing.
Exceptions
WrongSubclassCalled for a wrong subclass.

Reimplemented in RealCmdLineOptionParser.

Definition at line 114 of file CmdLineOptionParser.cc.

114  {
115  throw WrongSubclass(__FILE__, __LINE__, __func__);
116  return 0;
117 }

References __func__.

◆ setDefined()

void CmdLineOptionParser::setDefined ( )
protected

◆ shortName()

std::string CmdLineOptionParser::shortName ( ) const

◆ String()

std::string CmdLineOptionParser::String ( int  index = 0) const
virtual

This implementation should be never called.

Returns
Nothing.
Exceptions
WrongSubclassCalled for a wrong subclass.

Reimplemented in StringListCmdLineOptionParser, OptionalStringCmdLineOptionParser, and StringCmdLineOptionParser.

Definition at line 102 of file CmdLineOptionParser.cc.

102  {
103  throw WrongSubclass(__FILE__, __LINE__, __func__);
104  return "";
105 }

References __func__.

Referenced by TTAUnitTesterCmdLineOptions::adfFileName(), ExplorerCmdLineOptions::adfFileName(), ExplorerCmdLineOptions::adfOutFileName(), LLVMTCECmdLineOptions::backendCacheDir(), PIGCmdLineOptions::bemFile(), ProGeCmdLineOptions::bemFile(), ProGeCmdLineOptions::commaSeparatedList(), ExplorerCmdLineOptions::compilerOptionsString(), PIGCmdLineOptions::compressorParameter(), PIGCmdLineOptions::compressorPlugin(), PIGCmdLineOptions::dataImageOutputFormat(), ProGeCmdLineOptions::deviceFamilyName(), ProGeCmdLineOptions::deviceName(), ProGeCmdLineOptions::dmemType(), PIGCmdLineOptions::entityName(), ProGeCmdLineOptions::entityName(), ExplorerCmdLineOptions::explorerPlugin(), ExplorerCmdLineOptions::explorerPluginParameter(), LLVMTCECmdLineOptions::getLLVMargv(), ExplorerCmdLineOptions::hdbFileName(), ProGeCmdLineOptions::hdl(), ProGeCmdLineOptions::idfFile(), ExplorerCmdLineOptions::idfFileName(), ProGeCmdLineOptions::imemType(), ProGeCmdLineOptions::integratorName(), SchedulerCmdLineOptions::machineFile(), SimulatorCmdLineOptions::machineFile(), SchedulerCmdLineOptions::noaliasFunctions(), ProGeCmdLineOptions::outputDirectory(), BEMGeneratorCmdLineOptions::outputFile(), SchedulerCmdLineOptions::outputFile(), DisasmCmdLineOptions::outputFile(), MachInfoCmdLineOptions::outputFileNameSuffix(), MachInfoCmdLineOptions::outputFormat(), ExplorerCmdLineOptions::paretoSetValues(), ExplorerCmdLineOptions::pluginInfo(), ProGeCmdLineOptions::pluginParametersQuery(), LLVMTCECmdLineOptions::primaryFunctions(), PIGCmdLineOptions::progeOutputDirectory(), SimulatorCmdLineOptions::programFile(), PIGCmdLineOptions::programImageOutputFormat(), SimulatorCmdLineOptions::scriptString(), ProGeCmdLineOptions::sharedOutputDirectory(), BuildOpsetOptions::sourceDir(), LLVMTCECmdLineOptions::standardEmulationLib(), ExplorerCmdLineOptions::summaryOrdering(), LLVMTCECmdLineOptions::tempDir(), ExplorerCmdLineOptions::testApplicationDirectory(), EstimatorCmdLineOptions::TPEF(), PIGCmdLineOptions::tpefFile(), ProGeCmdLineOptions::tpefName(), EstimatorCmdLineOptions::traceDB(), TTAUnitTesterCmdLineOptions::vhdlSim(), TestHDBCmdLineOptions::vhdlSim(), and LLVMTCECmdLineOptions::workItemAAFile().

◆ unsignedInteger()

unsigned CmdLineOptionParser::unsignedInteger ( int  index = 0) const
virtual

Reimplemented in UnsignedIntegerCmdLineOptionParser.

Definition at line 90 of file CmdLineOptionParser.cc.

90  {
91  throw WrongSubclass(__FILE__, __LINE__, __func__);
92  return 0;
93 }

References __func__.

Referenced by LLVMTCECmdLineOptions::dataStartAddress(), and LLVMTCECmdLineOptions::initialStackPointerValue().

Member Data Documentation

◆ defined_

bool CmdLineOptionParser::defined_
private

Is the value of this option set in the parsed command line?

Definition at line 106 of file CmdLineOptionParser.hh.

Referenced by isDefined(), and setDefined().

◆ desc_

std::string CmdLineOptionParser::desc_
private

The description of option.

Definition at line 101 of file CmdLineOptionParser.hh.

◆ hidden_

bool CmdLineOptionParser::hidden_ = false
private

The hidden flag. If set, no entry is printed in the normal help text.

Definition at line 103 of file CmdLineOptionParser.hh.

Referenced by isHidden().

◆ longName_

std::string CmdLineOptionParser::longName_
private

The full name of an option.

Definition at line 97 of file CmdLineOptionParser.hh.

◆ shortName_

std::string CmdLineOptionParser::shortName_
private

The optional alias (shorter name).

Definition at line 99 of file CmdLineOptionParser.hh.


The documentation for this class was generated from the following files:
WrongSubclass
Definition: Exception.hh:336
CmdLineOptionParser::hidden_
bool hidden_
The hidden flag. If set, no entry is printed in the normal help text.
Definition: CmdLineOptionParser.hh:103
__func__
#define __func__
Definition: Application.hh:67
CmdLineOptionParser::longName_
std::string longName_
The full name of an option.
Definition: CmdLineOptionParser.hh:97
CmdLineOptionParser::desc_
std::string desc_
The description of option.
Definition: CmdLineOptionParser.hh:101
CmdLineOptionParser::shortName_
std::string shortName_
The optional alias (shorter name).
Definition: CmdLineOptionParser.hh:99
CmdLineOptionParser::defined_
bool defined_
Is the value of this option set in the parsed command line?
Definition: CmdLineOptionParser.hh:106