Class that controls the settings of the program. More...
#include <configuration.h>
Classes | |
struct | auto_group |
Class that automates the push and pop groups. More... | |
Public Member Functions | |
configuration () | |
Default constructor for configuration. | |
configuration (std::map< std::string, std::string > dictionary) | |
Constructor for configuration. More... | |
void | print_variables () const |
Print the currently set parameters. | |
void | print_help () const |
Print a help manual of the currently set parameters. | |
void | print_splash () const |
Print splash greeting messsages. | |
void | check_touched () const |
Check if all the parameters are loaded by the program. More... | |
bool | is_parameter_set (std::string name) const |
Check if a parameter with the name is set via command line. More... | |
bool | check_set (std::string name) const |
Check if a parameter with the name is set. More... | |
std::string | get_current_group_name (bool argument_name=false) const |
Get the name of the currently focused group (or argument name). More... | |
bool | stack_empty () const |
Get if the group stack is empty. More... | |
void | push_group (const credit &info) |
Push the group to the top of the group stack. More... | |
void | push_group (std::string name, std::string argument_name="", std::string author="", std::string address="", std::tuple< int, int, int > date=std::tuple< int, int, int >(0, 0, 0), double version=0.0) |
Push the group to the top of the group stack. More... | |
void | pop_group () |
Remove the current group from the gruop stack. | |
bool | get_integer (std::string name, int &value, std::string description=std::string()) |
Get the integer parameter. More... | |
void | set_integer (std::string name, int value) |
Set the integer parameter. More... | |
void | set_default_integer (std::string name, int value) |
Set default integer parameter. More... | |
bool | get_unsigned (std::string name, unsigned &value, std::string description=std::string()) |
Get the unsigned integer parameter. More... | |
void | set_unsigned (std::string name, unsigned value) |
Set the unsigned integer parameter. More... | |
void | set_default_unsigned (std::string name, unsigned value) |
Set default unsgined integer parameter. More... | |
bool | get_bool (std::string name, bool &value, std::string description=std::string()) |
Get the boolean parameter. More... | |
void | set_bool (std::string name, bool value) |
Set the boolean parameter. More... | |
void | set_default_bool (std::string name, bool value) |
Set default boolean parameter. More... | |
double | get_double (std::string name, double &value, std::string description=std::string()) |
Get the parameter of double type. More... | |
void | set_double (std::string name, double value) |
Set the parameter of double type. More... | |
void | set_default_double (std::string name, double value) |
Set default parameter of double type. More... | |
bool | get_real (std::string name, Real &value, std::string description=std::string()) |
Get the parameter of Real type. More... | |
void | set_real (std::string name, Real value) |
Set the parameter of Real type. More... | |
void | set_default_real (std::string name, Real value) |
Set default parameter of Real type. More... | |
bool | get_vec2i (std::string name, int value[2], std::string description=std::string()) |
Get the parameter of vec2i type. More... | |
void | set_vec2i (std::string name, const int value[2]) |
Set the parameter of vec2i type. More... | |
void | set_default_vec2i (std::string name, const int value[2]) |
Set default parameter of vec2i type. More... | |
bool | get_vec2d (std::string name, double value[2], std::string description=std::string()) |
Get the parameter of vec2d type. More... | |
void | set_vec2d (std::string name, const double value[2]) |
Set the parameter of vec2d type. More... | |
void | set_default_vec2d (std::string name, const double value[2]) |
Set default parameter of vec2d type. More... | |
bool | get_vec3i (std::string name, int value[3], std::string description=std::string()) |
Get the parameter of vec3i type. More... | |
void | set_vec3i (std::string name, const int value[3]) |
Set the parameter of vec3i type. More... | |
void | set_default_vec3i (std::string name, const int value[3]) |
Set default parameter of vec3i type. More... | |
bool | get_vec3d (std::string name, double value[3], std::string description=std::string()) |
Get the parameter of vec3d type. More... | |
void | set_vec3d (std::string name, const double value[3]) |
Set the parameter of vec3d type. More... | |
void | set_default_vec3d (std::string name, const double value[3]) |
Set default parameter of vec3d type. More... | |
bool | get_vec4d (std::string name, double value[4], std::string description=std::string()) |
Get the parameter of vec4d type. More... | |
void | set_vec4d (std::string name, const double value[4]) |
Set the parameter of vec4d type. More... | |
void | set_default_vec4d (std::string name, const double value[4]) |
Set default parameter of vec4d type. More... | |
bool | get_string (std::string name, std::string &value, std::string description=std::string()) |
Get the string parameter. More... | |
void | set_string (std::string name, std::string value) |
Set string parameter. More... | |
void | set_default_string (std::string name, std::string value) |
Set default string parameter. More... | |
bool | exist (std::string name) const |
Get if the parameter of the input name exists. More... | |
const std::map< std::string, std::string > & | get_dictionary () const |
Get the dictionary of parameter. More... | |
Static Public Member Functions | |
static void | print_bar (std::string str="") |
Print the input message surrounded by --—. | |
static void | print_center (std::string str) |
Print the input message at the center of the line. | |
Class that controls the settings of the program.
configuration::configuration | ( | std::map< std::string, std::string > | dictionary | ) |
Constructor for configuration.
[in] | dictionary | List of parameters. |
bool configuration::check_set | ( | std::string | name | ) | const |
Check if a parameter with the name is set.
[in] | name | Name of parameter. |
true
if all the name with parameter is set. false
otherwise. void configuration::check_touched | ( | ) | const |
Check if all the parameters are loaded by the program.
true
if all the parameters are loaded. false
otherwise. bool configuration::exist | ( | std::string | name | ) | const |
Get if the parameter of the input name exists.
[in] | name | Name of the parameter. |
true
if the parameter exists false
otherwise. bool configuration::get_bool | ( | std::string | name, |
bool & | value, | ||
std::string | description = std::string() |
||
) |
Get the boolean parameter.
[in] | name | Name of the parameter. |
[out] | value | Output value. |
[in] | description | Description of the parameter. |
std::string configuration::get_current_group_name | ( | bool | argument_name = false | ) | const |
Get the name of the currently focused group (or argument name).
[in] | argument_name | Request argument name. |
|
inline |
Get the dictionary of parameter.
double configuration::get_double | ( | std::string | name, |
double & | value, | ||
std::string | description = std::string() |
||
) |
Get the parameter of double type.
[in] | name | Name of the parameter. |
[out] | value | Output value. |
[in] | description | Description of the parameter. |
bool configuration::get_integer | ( | std::string | name, |
int & | value, | ||
std::string | description = std::string() |
||
) |
Get the integer parameter.
[in] | name | Name of the parameter. |
[out] | value | Output value. |
[in] | description | Description of the parameter. |
bool configuration::get_real | ( | std::string | name, |
Real & | value, | ||
std::string | description = std::string() |
||
) |
Get the parameter of Real type.
[in] | name | Name of the parameter. |
[out] | value | Output value. |
[in] | description | Description of the parameter. |
bool configuration::get_string | ( | std::string | name, |
std::string & | value, | ||
std::string | description = std::string() |
||
) |
Get the string parameter.
[in] | name | Name of the parameter. |
[out] | value | Output value. |
[in] | description | Description of the parameter. |
bool configuration::get_unsigned | ( | std::string | name, |
unsigned & | value, | ||
std::string | description = std::string() |
||
) |
Get the unsigned integer parameter.
[in] | name | Name of the parameter. |
[out] | value | Output value. |
[in] | description | Description of the parameter. |
bool configuration::get_vec2d | ( | std::string | name, |
double | value[2], | ||
std::string | description = std::string() |
||
) |
Get the parameter of vec2d type.
[in] | name | Name of the parameter. |
[out] | value | Output value. |
[in] | description | Description of the parameter. |
bool configuration::get_vec2i | ( | std::string | name, |
int | value[2], | ||
std::string | description = std::string() |
||
) |
Get the parameter of vec2i type.
[in] | name | Name of the parameter. |
[out] | value | Output value. |
[in] | description | Description of the parameter. |
bool configuration::get_vec3d | ( | std::string | name, |
double | value[3], | ||
std::string | description = std::string() |
||
) |
Get the parameter of vec3d type.
[in] | name | Name of the parameter. |
[out] | value | Output value. |
[in] | description | Description of the parameter. |
bool configuration::get_vec3i | ( | std::string | name, |
int | value[3], | ||
std::string | description = std::string() |
||
) |
Get the parameter of vec3i type.
[in] | name | Name of the parameter. |
[out] | value | Output value. |
[in] | description | Description of the parameter. |
bool configuration::get_vec4d | ( | std::string | name, |
double | value[4], | ||
std::string | description = std::string() |
||
) |
Get the parameter of vec4d type.
[in] | name | Name of the parameter. |
[out] | value | Output value. |
[in] | description | Description of the parameter. |
bool configuration::is_parameter_set | ( | std::string | name | ) | const |
Check if a parameter with the name is set via command line.
[in] | name | Name of parameter. |
true
if all the name with parameter is set. false
otherwise. void configuration::push_group | ( | const credit & | info | ) |
Push the group to the top of the group stack.
[in] | info | An instance of credit from which group information is extracted. |
void configuration::push_group | ( | std::string | name, |
std::string | argument_name = "" , |
||
std::string | author = "" , |
||
std::string | address = "" , |
||
std::tuple< int, int, int > | date = std::tuple< int, int, int >(0, 0, 0) , |
||
double | version = 0.0 |
||
) |
Push the group to the top of the group stack.
[in] | name | Name of the group. |
[in] | argument_name | Argument name of the group. |
[in] | author | Author of the corresponding group. |
[in] | address | Email address of the corresponding group. |
[in] | date | Date of the corresponding group. |
[in] | version | Version of the group. |
void configuration::set_bool | ( | std::string | name, |
bool | value | ||
) |
Set the boolean parameter.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_default_bool | ( | std::string | name, |
bool | value | ||
) |
Set default boolean parameter.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_default_double | ( | std::string | name, |
double | value | ||
) |
Set default parameter of double type.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_default_integer | ( | std::string | name, |
int | value | ||
) |
Set default integer parameter.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_default_real | ( | std::string | name, |
Real | value | ||
) |
Set default parameter of Real type.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_default_string | ( | std::string | name, |
std::string | value | ||
) |
Set default string parameter.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_default_unsigned | ( | std::string | name, |
unsigned | value | ||
) |
Set default unsgined integer parameter.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_default_vec2d | ( | std::string | name, |
const double | value[2] | ||
) |
Set default parameter of vec2d type.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_default_vec2i | ( | std::string | name, |
const int | value[2] | ||
) |
Set default parameter of vec2i type.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_default_vec3d | ( | std::string | name, |
const double | value[3] | ||
) |
Set default parameter of vec3d type.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_default_vec3i | ( | std::string | name, |
const int | value[3] | ||
) |
Set default parameter of vec3i type.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_default_vec4d | ( | std::string | name, |
const double | value[4] | ||
) |
Set default parameter of vec4d type.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_double | ( | std::string | name, |
double | value | ||
) |
Set the parameter of double type.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_integer | ( | std::string | name, |
int | value | ||
) |
Set the integer parameter.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_real | ( | std::string | name, |
Real | value | ||
) |
Set the parameter of Real type.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_string | ( | std::string | name, |
std::string | value | ||
) |
Set string parameter.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_unsigned | ( | std::string | name, |
unsigned | value | ||
) |
Set the unsigned integer parameter.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_vec2d | ( | std::string | name, |
const double | value[2] | ||
) |
Set the parameter of vec2d type.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_vec2i | ( | std::string | name, |
const int | value[2] | ||
) |
Set the parameter of vec2i type.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_vec3d | ( | std::string | name, |
const double | value[3] | ||
) |
Set the parameter of vec3d type.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_vec3i | ( | std::string | name, |
const int | value[3] | ||
) |
Set the parameter of vec3i type.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
void configuration::set_vec4d | ( | std::string | name, |
const double | value[4] | ||
) |
Set the parameter of vec4d type.
[in] | name | Name of the parameter. |
[in] | value | Value to set. |
|
inline |
Get if the group stack is empty.
true
if the stack is empty. false
otherwise.