IODA Bundle
odc::tool::CommandLineParser Class Reference

#include <CommandLineParser.h>

Inheritance diagram for odc::tool::CommandLineParser:
[legend]

Public Member Functions

 CommandLineParser (int argc, char **argv)
 
 CommandLineParser (const CommandLineParser &)
 
CommandLineParseroperator= (const CommandLineParser &)
 
virtual ~CommandLineParser ()
 
void registerOptionWithArgument (const std::string &)
 
const std::vector< std::string > parameters ()
 
std::string parameters (size_t i)
 
bool optionIsSet (const std::string &)
 
template<typename T >
optionArgument (const std::string &, T defaultValue)
 
int argc ()
 
std::string argv (int i)
 
char ** argv ()
 

Private Member Functions

void parseCommandLine ()
 
void print (std::ostream &s) const
 

Private Attributes

bool commandLineParsed_
 
int argc_
 
char ** argv_
 
std::set< std::string > registeredOptionsWithArguments_
 
std::map< std::string, std::string > optionsWithArguments_
 
std::set< std::string > optionsNoArguments_
 
std::vector< std::string > parameters_
 

Friends

std::ostream & operator<< (std::ostream &s, const CommandLineParser &o)
 

Detailed Description

Definition at line 27 of file CommandLineParser.h.

Constructor & Destructor Documentation

◆ CommandLineParser() [1/2]

odc::tool::CommandLineParser::CommandLineParser ( int  argc,
char **  argv 
)

Definition at line 24 of file CommandLineParser.cc.

◆ CommandLineParser() [2/2]

odc::tool::CommandLineParser::CommandLineParser ( const CommandLineParser other)

Definition at line 34 of file CommandLineParser.cc.

Here is the call graph for this function:

◆ ~CommandLineParser()

odc::tool::CommandLineParser::~CommandLineParser ( )
virtual

Definition at line 22 of file CommandLineParser.cc.

Member Function Documentation

◆ argc()

int odc::tool::CommandLineParser::argc ( )

Definition at line 64 of file CommandLineParser.cc.

Here is the caller graph for this function:

◆ argv() [1/2]

char** odc::tool::CommandLineParser::argv ( )
inline

Definition at line 53 of file CommandLineParser.h.

Here is the caller graph for this function:

◆ argv() [2/2]

std::string odc::tool::CommandLineParser::argv ( int  i)

Definition at line 66 of file CommandLineParser.cc.

◆ operator=()

CommandLineParser & odc::tool::CommandLineParser::operator= ( const CommandLineParser other)

Definition at line 47 of file CommandLineParser.cc.

Here is the call graph for this function:

◆ optionArgument()

template<typename T >
template double odc::tool::CommandLineParser::optionArgument ( const std::string &  ,
defaultValue 
)
Returns
value of the command line option passed to the tool converted to given type, or value of the second parameter if option not present on command line.

Definition at line 99 of file CommandLineParser.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ optionIsSet()

bool odc::tool::CommandLineParser::optionIsSet ( const std::string &  option)
Returns
true if argumentless option is set

Definition at line 88 of file CommandLineParser.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parameters() [1/2]

const std::vector< std::string > odc::tool::CommandLineParser::parameters ( )
Returns
command line parameters (without the options starting with '-')

Definition at line 82 of file CommandLineParser.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parameters() [2/2]

std::string odc::tool::CommandLineParser::parameters ( size_t  i)
inline

Definition at line 41 of file CommandLineParser.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseCommandLine()

void odc::tool::CommandLineParser::parseCommandLine ( )
private

Definition at line 111 of file CommandLineParser.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print()

void odc::tool::CommandLineParser::print ( std::ostream &  s) const
private

Definition at line 139 of file CommandLineParser.cc.

◆ registerOptionWithArgument()

void odc::tool::CommandLineParser::registerOptionWithArgument ( const std::string &  option)

Definition at line 77 of file CommandLineParser.cc.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
const CommandLineParser o 
)
friend

Definition at line 71 of file CommandLineParser.h.

Member Data Documentation

◆ argc_

int odc::tool::CommandLineParser::argc_
private

Definition at line 61 of file CommandLineParser.h.

◆ argv_

char** odc::tool::CommandLineParser::argv_
private

Definition at line 62 of file CommandLineParser.h.

◆ commandLineParsed_

bool odc::tool::CommandLineParser::commandLineParsed_
private

Definition at line 60 of file CommandLineParser.h.

◆ optionsNoArguments_

std::set<std::string> odc::tool::CommandLineParser::optionsNoArguments_
private

Definition at line 67 of file CommandLineParser.h.

◆ optionsWithArguments_

std::map<std::string, std::string> odc::tool::CommandLineParser::optionsWithArguments_
private

Definition at line 66 of file CommandLineParser.h.

◆ parameters_

std::vector<std::string> odc::tool::CommandLineParser::parameters_
private

Definition at line 68 of file CommandLineParser.h.

◆ registeredOptionsWithArguments_

std::set<std::string> odc::tool::CommandLineParser::registeredOptionsWithArguments_
private

Definition at line 64 of file CommandLineParser.h.


The documentation for this class was generated from the following files: