RAPIDO
Repeatable Analysis Programming for Interpretability, Durability, and Organization
|
#include <utilities.h>
Public Member Functions | |
Variables () | |
virtual | ~Variables () |
template<typename Type > | |
void | newVar (std::string new_name) |
template<typename Type > | |
void | newVar (std::string new_name, Type new_reset_value) |
template<typename Type > | |
Type | getVal (std::string name) |
template<typename Type > | |
Type & | getRef (std::string name) |
template<typename Type > | |
void | setVal (std::string name, Type new_value) |
template<typename Type > | |
void | resetVal (std::string name) |
void | resetVars () |
Protected Member Functions | |
template<typename Type > | |
Variable< Type > * | getVar (std::string name) |
Protected Attributes | |
std::map< std::string, Dynamic * > | variables |
std::map< std::string, std::function< void()> > | resetters |
A group of "dynamic" variables
Utilities::Variables::Variables | ( | ) |
Variables object constructor
|
virtual |
Variables object destructor
Type & Utilities::Variables::getRef | ( | std::string | name | ) |
Get variable value in map by reference if it exists
Type | type of variable |
name | name of variable |
Type Utilities::Variables::getVal | ( | std::string | name | ) |
Get variable value in map if it exists
Type | type of variable |
name | name of variable |
|
protected |
(PROTECTED) Retrieve variable object from map if it exists
Type | type of variable |
name | name of variable |
void Utilities::Variables::newVar | ( | std::string | new_name | ) |
Add blank variable to map
Type | type of new variable |
new_name | name of new variable |
void Utilities::Variables::newVar | ( | std::string | new_name, |
Type | new_reset_value ) |
Add new variable to map with reset value
Type | type of variable |
new_name | name of variable |
new_reset_value | reset value of new variable |
void Utilities::Variables::resetVal | ( | std::string | name | ) |
Set value of a variable in map to its reset value if it exists
Type | type of variable |
name | name of variable |
void Utilities::Variables::resetVars | ( | ) |
Set value of each variable in map to its respective reset value.
Uses a map of "resetters" because Utilities::Variable<Type>::resetValue() cannot be called across an arbitrary number of such objects, due to the fact that the value of Type for each object would need to be supplied. The "resetters" circumvent this issue by capturing the function call in a lambda function for later use.
void Utilities::Variables::setVal | ( | std::string | name, |
Type | new_value ) |
Set value of a variable in map if it exists
Type | type of variable |
name | name of variable |
new_value | new value for variable |
|
protected |
Map of Utilities::Variable::resetValue functions captured in lambdas
|
protected |
Map of Utilities::Variable objects