PFASST++
pfasst::config::options Class Reference

Runtime config options provider. More...

#include <config.hpp>

+ Collaboration diagram for pfasst::config::options:

Public Member Functions

void init ()
 Initialize program options. More...
 

Static Public Member Functions

static void add_option (const string &group, const string &option, const string &help)
 Adds a new boolean flag. More...
 
template<typename T >
static void add_option (const string &group, const string &option, const string &help)
 Adds a new parameter with an expected value of type T. More...
 

Static Public Attributes

static const size_t LINE_WIDTH = 100
 line width of help and usage information More...
 

Private Member Functions

 options ()
 
 options (const options &)=delete
 
void operator= (const options &)=delete
 

Private Attributes

po::options_description all_options
 
map< string, po::options_description > option_groups
 
po::variables_map variables_map
 
vector< string > unrecognized_args
 
bool initialized = false
 
static optionsget_instance ()
 Accessor to the singleton instance. More...
 
po::variables_map & get_variables_map ()
 
po::options_description & get_all_options ()
 
vector< string > & get_unrecognized_args ()
 

Detailed Description

Runtime config options provider.

This singleton provides easy access to command line parameters at runtime.

Note
This uses the Singleton Pattern, and hence pfasst::options::get_instance() is thread-safe with C++11.
Since
v0.3.0

Definition at line 65 of file config.hpp.

Constructor & Destructor Documentation

pfasst::config::options::options ( )
private

Definition at line 13 of file config_impl.hpp.

pfasst::config::options::options ( const options )
privatedelete

Member Function Documentation

void pfasst::config::options::add_option ( const string &  group,
const string &  option,
const string &  help 
)
static

Adds a new boolean flag.

Parameters
[in]groupstring identifying the parameter group
[in]optionName of the command line parameter. It is possible to specify a long and optional short option name by comma-separation. Short option names are identified by being only a single character. They are automatically parsed as '-[SHORT]' by boost::program_options in contrast to '--[LONG]'.
[in]helphelp text to be displayed in the help and usage information
Todo:
Make config::options::add_option() fail when called called after config::options::init().

Definition at line 41 of file config_impl.hpp.

template<typename T >
void pfasst::config::options::add_option ( const string &  group,
const string &  option,
const string &  help 
)
static

Adds a new parameter with an expected value of type T.

Template Parameters
Ttype of the specified parameter
Parameters
[in]groupstring identifying the parameter group
[in]optionName of the command line parameter. It is possible to specify a long and optional short option name by comma-separation. Short option names are identified by being only a single character. They are automatically parsed as '-[SHORT]' by boost::program_options in contrast to '--[LONG]'.
[in]helphelp text to be displayed in the help and usage information

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Todo:
Make config::options::add_option() fail when called called after config::options::init().

Definition at line 57 of file config_impl.hpp.

po::options_description & pfasst::config::options::get_all_options ( )

Definition at line 27 of file config_impl.hpp.

options & pfasst::config::options::get_instance ( )
static

Accessor to the singleton instance.

Returns
singleton config::options instance

Definition at line 16 of file config_impl.hpp.

Referenced by pfasst::log::add_custom_logger(), and pfasst::log::set_global_logging_options().

+ Here is the caller graph for this function:

vector< string > & pfasst::config::options::get_unrecognized_args ( )

Definition at line 32 of file config_impl.hpp.

po::variables_map & pfasst::config::options::get_variables_map ( )

Definition at line 22 of file config_impl.hpp.

Referenced by pfasst::log::add_custom_logger(), and pfasst::log::set_global_logging_options().

+ Here is the caller graph for this function:

void pfasst::config::options::init ( )

Initialize program options.

This initializes boost::program_options with all previously added options and groups.

Todo:
Make config::options::init() fail when called twice.

Definition at line 72 of file config_impl.hpp.

References pfasst::log::initialized.

void pfasst::config::options::operator= ( const options )
privatedelete

Member Data Documentation

po::options_description pfasst::config::options::all_options
private

Definition at line 72 of file config.hpp.

bool pfasst::config::options::initialized = false
private

Definition at line 76 of file config.hpp.

const size_t pfasst::config::options::LINE_WIDTH = 100
static

line width of help and usage information

Definition at line 69 of file config.hpp.

map<string, po::options_description> pfasst::config::options::option_groups
private

Definition at line 73 of file config.hpp.

vector<string> pfasst::config::options::unrecognized_args
private

Definition at line 75 of file config.hpp.

po::variables_map pfasst::config::options::variables_map
private

Definition at line 74 of file config.hpp.


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