SOFA API  6a688117
Open source framework for multi-physics simuation
sofa::helper::ArgumentParser Class Reference

#include <ArgumentParser.h>

Detailed Description

Command line parser

This object parses arguments from a command line or from an input stream.

See also
Argument

Static Public Attributes

static std::vector< std::string > extra = std::vector<std::string>()
 

Public Member Functions

 ArgumentParser (int argc, char **argv)
 constructor

More...
 
 ~ArgumentParser ()
 
void addArgument (const value_semantic *s, const std::string name, const std::string help)
 addArgument More...
 
void addArgument (const std::string name, const std::string help)
 addArgument More...
 
void showHelp ()
 simply display the help (You need to add -h –help options in your main and call this function by yourself More...
 
void parse ()
 this is the main function. You have to call this function if you want to parse the arguments given to the constructor More...
 
void showArgs ()
 display args with values More...
 
variables_map getVariableMap ()
 
std::vector< std::string > getInputFileList ()
 

Static Public Member Functions

static const std::vector< std::string > extra_args ()
 return extra_args needed for python (arguments) More...
 

Attribute details

std::vector< std::string > sofa::helper::ArgumentParser::extra = std::vector<std::string>()
static

last parsed extra arguments extra parameter needed for python (arguments)

Constructor details

sofa::helper::ArgumentParser::ArgumentParser ( int  argc,
char **  argv 
)

constructor

Parameters
argcfrom command line
argvfrom command line
sofa::helper::ArgumentParser::~ArgumentParser ( )

Function details

void sofa::helper::ArgumentParser::addArgument ( const value_semantic *  s,
const std::string  name,
const std::string  help 
)

addArgument

Can be call if you want to add parameters

Parameters
sboost_program_option semantic for examples
See also
runSofa/main.cpp
Parameters
nameargument name such as "help,h" after the comma it's a character use as short name
helpdescribing the argument
void sofa::helper::ArgumentParser::addArgument ( const std::string  name,
const std::string  help 
)

addArgument

Can be call if you want to add parameters

Parameters
nameargument name such as "help,h" after the comma it's a character use as short name
helpdescribing the argument
static const std::vector<std::string> sofa::helper::ArgumentParser::extra_args ( )
inlinestatic

return extra_args needed for python (arguments)

std::vector< std::string > sofa::helper::ArgumentParser::getInputFileList ( )
boost::program_options::variables_map sofa::helper::ArgumentParser::getVariableMap ( )
void sofa::helper::ArgumentParser::parse ( )

this is the main function. You have to call this function if you want to parse the arguments given to the constructor

void sofa::helper::ArgumentParser::showArgs ( )

display args with values

void sofa::helper::ArgumentParser::showHelp ( )

simply display the help (You need to add -h –help options in your main and call this function by yourself

See also
runSofa/main.cpp)