SUMO - Simulation of Urban MObility
OptionsIO Class Reference

#include <OptionsIO.h>

Static Public Member Functions

static void getOptions (bool loadConfig, int argc=0, char **argv=0)
 Parses the command line arguments and loads the configuration optionally. More...
 
static void loadConfiguration ()
 Loads and parses the configuration. More...
 

Static Private Attributes

static int myArgC
 
static char ** myArgV
 

Detailed Description

Helping methods for parsing of command line arguments and reading a configuration file. Any errors are reported by throwing a ProcessError exception which contains a description about the failure.

Definition at line 54 of file OptionsIO.h.

Member Function Documentation

void OptionsIO::getOptions ( bool  loadConfig,
int  argc = 0,
char **  argv = 0 
)
static

Parses the command line arguments and loads the configuration optionally.

Command line arguments are parsed, first, throwing a ProcessError if something fails. If loadConfig is false, the method returns after this. Otherwise, options are reset to being writeable and the configuration is loaded using "loadConfiguration". After this, the options are reset again and the command line arguments are reparsed.

This workflow allows to read the name of a configuration file from command line arguments, first, then to load values from this configuration file and reset them by other values from the command line.

Parameters
[in]loadConfigWhether the configuration shall be loaded
[in]argcnumber of arguments given at the command line
[in]argvarguments given at the command line

Definition at line 64 of file OptionsIO.cpp.

References OptionsCont::getOptions(), loadConfiguration(), myArgC, myArgV, OptionsParser::parse(), and OptionsCont::resetWritable().

Referenced by GUILoadThread::initOptions(), and main().

void OptionsIO::loadConfiguration ( )
static

Loads and parses the configuration.

The name of the configuration file is extracted from the global OptionsCont ("configuration-file" is used as the name of the option to get the name of the configuration).

Definition at line 89 of file OptionsIO.cpp.

References TplConvert::_2str(), OptionsLoader::errorOccured(), OptionsCont::exists(), OptionsCont::getOptions(), OptionsCont::getString(), FileHelpers::isReadable(), OptionsCont::isSet(), PROGRESS_BEGIN_MESSAGE, PROGRESS_DONE_MESSAGE, and OptionsCont::relocateFiles().

Referenced by getOptions().

Field Documentation

int OptionsIO::myArgC
staticprivate

Definition at line 86 of file OptionsIO.h.

Referenced by getOptions().

char ** OptionsIO::myArgV
staticprivate

Definition at line 87 of file OptionsIO.h.

Referenced by getOptions().


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