OpenASIP 2.2
Loading...
Searching...
No Matches
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.
 
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.
 
CmdLineOptionParseroperator= (const CmdLineOptionParser &)
 Assignment not allowed.
 

Private Attributes

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

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}
bool hidden_
The hidden flag. If set, no entry is printed in the normal help text.
bool defined_
Is the value of this option set in the parsed command line?
std::string longName_
The full name of an option.
std::string shortName_
The optional alias (shorter name).
std::string desc_
The description of option.

◆ ~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(), ProgramImageGenerator::dataStartAddress(), LLVMTCECmdLineOptions::dataStartAddress(), LLVMTCECmdLineOptions::disableAddressSpaceAA(), LLVMTCECmdLineOptions::disableDelaySlotFiller(), LLVMTCECmdLineOptions::disableHWLoops(), LLVMTCECmdLineOptions::disableLLVMAA(), LLVMTCECmdLineOptions::dumpDDGsDot(), LLVMTCECmdLineOptions::dumpDDGsXML(), ExplorerCmdLineOptions::idfFile(), LLVMTCECmdLineOptions::isDataStartAddressSet(), ProgramImageGenerator::isDataStartSet(), TestHDBCmdLineOptions::isFUEntryIDGiven(), LLVMTCECmdLineOptions::isInitialStackPointerValueSet(), SchedulerCmdLineOptions::isLoopOptDefined(), SchedulerCmdLineOptions::isMachineFileDefined(), LLVMTCECmdLineOptions::isOptLevelDefined(), SchedulerCmdLineOptions::isOutputFileDefined(), TestHDBCmdLineOptions::isRFEntryIDGiven(), LLVMTCECmdLineOptions::isStandardEmulationLibDefined(), CmdLineOptions::isVerboseSpamSwitchDefined(), LLVMTCECmdLineOptions::isVerboseSwitchDefined(), CmdLineOptions::isVerboseSwitchDefined(), LLVMTCECmdLineOptions::isWorkItemAAFileDefined(), CmdLineOptions::optionGiven(), DisasmCmdLineOptions::outputFileDefined(), ExplorerCmdLineOptions::printSummary(), 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 OptionalStringCmdLineOptionParser, and BoolCmdLineOptionParser.

Definition at line 138 of file CmdLineOptionParser.cc.

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

References __func__.

Referenced by AsmCmdLineOptions::printWarnings().

◆ isFlagOn()

bool CmdLineOptionParser::isFlagOn ( ) const
virtual

This implementation should never be called.

Returns
Nothing.
Exceptions
WrongSubclassCalled for a wrong subclass.

Reimplemented in OptionalStringCmdLineOptionParser, and BoolCmdLineOptionParser.

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(), DictionaryToolCmdLineOptions::doNotPrintErrors(), SchedulerCmdLineOptions::dumpIfConversionCFGs(), SchedulerCmdLineOptions::enableOffsetAA(), SchedulerCmdLineOptions::enableStackAA(), DisasmCmdLineOptions::flatFile(), ProGeCmdLineOptions::forceOutputDirectory(), PIGCmdLineOptions::generateDataImages(), PIGCmdLineOptions::generateDecompressor(), ProGeCmdLineOptions::generateTestbench(), BuildOpsetOptions::ignore(), SchedulerCmdLineOptions::killDeadResults(), TestHDBCmdLineOptions::leaveDirty(), TTAUnitTesterCmdLineOptions::leaveDirty(), DisasmCmdLineOptions::lineNumbers(), ProGeCmdLineOptions::listAvailableIntegrators(), EstimatorCmdLineOptions::longestPath(), ExplorerCmdLineOptions::numberOfConfigurations(), ProGeCmdLineOptions::preferHDLGeneration(), ExplorerCmdLineOptions::printApplications(), DictionaryToolCmdLineOptions::printConnections(), DictionaryToolCmdLineOptions::printGlobalRegister(), DictionaryToolCmdLineOptions::printMissingConnections(), ExplorerCmdLineOptions::printPlugins(), DictionaryToolCmdLineOptions::printPrimitive(), SchedulerCmdLineOptions::printResourceConstraints(), DictionaryToolCmdLineOptions::printRFConnections(), DisasmCmdLineOptions::printToStdout(), SchedulerCmdLineOptions::renameRegisters(), ProGeCmdLineOptions::resetAllRegisters(), LLVMTCECmdLineOptions::saveBackendPlugin(), PIGCmdLineOptions::showCompressors(), ProGeCmdLineOptions::syncReset(), EstimatorCmdLineOptions::totalArea(), EstimatorCmdLineOptions::totalEnergy(), ProGeCmdLineOptions::useAbsolutePaths(), TestHDBCmdLineOptions::verbose(), TTAUnitTesterCmdLineOptions::verbose(), and DictionaryToolCmdLineOptions::writeBinary().

◆ 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 StringCmdLineOptionParser, OptionalStringCmdLineOptionParser, and StringListCmdLineOptionParser.

Definition at line 102 of file CmdLineOptionParser.cc.

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

References __func__.

Referenced by ExplorerCmdLineOptions::adfFileName(), TTAUnitTesterCmdLineOptions::adfFileName(), ExplorerCmdLineOptions::adfOutFileName(), LLVMTCECmdLineOptions::backendCacheDir(), PIGCmdLineOptions::bemFile(), ProGeCmdLineOptions::bemFile(), ProGeCmdLineOptions::commaSeparatedList(), ExplorerCmdLineOptions::compilerOptionsString(), PIGCmdLineOptions::compressorParameter(), PIGCmdLineOptions::compressorPlugin(), PIGCmdLineOptions::dataImageOutputFormat(), ProgramImageGenerator::dataStartAddress(), LLVMTCECmdLineOptions::dataStartAddress(), 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(), LLVMTCECmdLineOptions::isDataStartAddressSet(), ProgramImageGenerator::isDataStartSet(), SimulatorCmdLineOptions::machineFile(), SchedulerCmdLineOptions::machineFile(), SchedulerCmdLineOptions::noaliasFunctions(), ProGeCmdLineOptions::outputDirectory(), AsmCmdLineOptions::outputFile(), DisasmCmdLineOptions::outputFile(), SchedulerCmdLineOptions::outputFile(), BEMGeneratorCmdLineOptions::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(), TestHDBCmdLineOptions::vhdlSim(), TTAUnitTesterCmdLineOptions::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::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: