Config Class Reference

The Config class is the base class of all specialized configurations that have a direct key -> value mapping. More...

#include <armarx/control/hardware_config/Config.h>

+ Inheritance diagram for Config:

Public Member Functions

virtual bool checkAllItemsRead (std::vector< std::string > &errors) const
 This method is called once the device has read the configuration data it needs. More...
 
 Config ()
 
bool getBool (const std::string name)
 Get a Bool typed Config attribute by name. More...
 
std::list< bool > getBoolList (const std::string name)
 Get a BoolList (std::list<bool>) typed Config attribute by name. More...
 
float getFloat (const std::string name)
 Get a Float typed Config attribute by name. More...
 
std::list< floatgetFloatList (const std::string name)
 Get a FloatList (std::list<float>) typed Config attribute by name. More...
 
std::int32_t getInt (const std::string name)
 Get a Int (std::int32_t) typed Config attribute by name. More...
 
std::list< std::int32_t > getIntList (const std::string name)
 Get a IntList (std::list<std::int32_t>) typed Config attribute by name. More...
 
types::LinearConfig getLinearConfig (const std::string name)
 Get a LinearConvertedValue typed Config attribute by name. More...
 
template<typename Type , int Rows, int Columns>
Eigen::Matrix< Type, Rows, Columns > getMatrix (const std::string name)
 Get a Matrix by name. More...
 
types::ModularConvertedValueConfig getModularConvertedValueConfig (const std::string &name)
 Get a ModularConvertedValue typed Config attribute by name. More...
 
std::string getString (const std::string name)
 Get a String typed Config attribute by name. More...
 
std::uint32_t getUint (const std::string name)
 Get a Uint (std::uint32_t) typed Config attribute by name. More...
 
std::list< std::uint32_t > getUintList (const std::string name)
 Get a UIntList (std::list<std::uint32_t>) typed Config attribute by name. More...
 
virtual void onParsingFinished ()
 This method is called when the config is completely read form the HardwareConfig file. More...
 
virtual void print (std::stringstream &s, int indention) const
 Print this configuration. More...
 
virtual ~Config ()=default
 

Protected Member Functions

template<typename T >
T get (const std::string name)
 
template<typename T >
std::optional< Tget_nothrow (const std::string name)
 
template<class T >
void set (const std::string name, T value, ConfigTag tag)
 
void setBool (const std::string name, bool value, ConfigTag tag)
 
void setBoolList (const std::string name, std::list< bool > value, ConfigTag tag)
 
void setFloat (const std::string name, float value, ConfigTag tag)
 
void setFloatList (const std::string name, std::list< float > value, ConfigTag tag)
 
void setInt (const std::string name, std::int32_t value, ConfigTag tag)
 
void setIntList (const std::string name, std::list< std::int32_t > value, ConfigTag tag)
 
void setLinearConfig (const std::string name, types::LinearConfig &&value, ConfigTag tag)
 
void setModularConvertedValueConfig (const std::string name, types::ModularConvertedValueConfig &&value, ConfigTag tag)
 
void setString (const std::string name, std::string value, ConfigTag tag)
 
void setUint (const std::string name, std::uint32_t value, ConfigTag tag)
 
void setUintList (const std::string name, std::list< std::uint32_t > value, ConfigTag tag)
 

Protected Attributes

std::map< std::string, ConfigItemWithMetadataitems
 

Friends

class ConfigParser
 
class ControllerConfig
 

Detailed Description

The Config class is the base class of all specialized configurations that have a direct key -> value mapping.

Direct instantiation is always possible, if this mapping is all that is needed. A Config in read-only and only ConfigParser can change the contents.

Definition at line 91 of file Config.h.

Constructor & Destructor Documentation

◆ Config()

Config ( )

Definition at line 5 of file Config.cpp.

◆ ~Config()

virtual ~Config ( )
virtualdefault

Member Function Documentation

◆ checkAllItemsRead()

bool checkAllItemsRead ( std::vector< std::string > &  errors) const
virtual

This method is called once the device has read the configuration data it needs.

In this method it should be checked, whether there are entries in this Config (including config objects that are stored in the Config).

Returns
true iff all items in this config have been read

Reimplemented in DeviceConfig, and SlaveConfig.

Definition at line 76 of file Config.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get()

T get ( const std::string  name)
inlineprotected

Definition at line 328 of file Config.h.

◆ get_nothrow()

std::optional<T> get_nothrow ( const std::string  name)
inlineprotected

Definition at line 311 of file Config.h.

◆ getBool()

bool getBool ( const std::string  name)

Get a Bool typed Config attribute by name.

Parameters
namethe name of this Config attribute
Exceptions
ConfigElementNotFoundErrorif there is no Bool value to this key
Returns
the value

Definition at line 10 of file Config.cpp.

+ Here is the caller graph for this function:

◆ getBoolList()

std::list< bool > getBoolList ( const std::string  name)

Get a BoolList (std::list<bool>) typed Config attribute by name.

Parameters
namethe name of this Config attribute
Exceptions
ConfigElementNotFoundErrorif there is no BoolList value to this key
Returns
the value

Definition at line 52 of file Config.cpp.

◆ getFloat()

float getFloat ( const std::string  name)

Get a Float typed Config attribute by name.

Parameters
namethe name of this Config attribute
Exceptions
ConfigElementNotFoundErrorif there is no Float value to this key
Returns
the value

Definition at line 16 of file Config.cpp.

+ Here is the caller graph for this function:

◆ getFloatList()

std::list< float > getFloatList ( const std::string  name)

Get a FloatList (std::list<float>) typed Config attribute by name.

Parameters
namethe name of this Config attribute
Exceptions
ConfigElementNotFoundErrorif there is no FloatList value to this key
Returns
the value

Definition at line 58 of file Config.cpp.

+ Here is the caller graph for this function:

◆ getInt()

std::int32_t getInt ( const std::string  name)

Get a Int (std::int32_t) typed Config attribute by name.

Parameters
namethe name of this Config attribute
Exceptions
ConfigElementNotFoundErrorif there is no Int value to this key
Returns
the value

Definition at line 28 of file Config.cpp.

+ Here is the caller graph for this function:

◆ getIntList()

std::list< std::int32_t > getIntList ( const std::string  name)

Get a IntList (std::list<std::int32_t>) typed Config attribute by name.

Parameters
namethe name of this Config attribute
Exceptions
ConfigElementNotFoundErrorif there is no IntList value to this key
Returns
the value

Definition at line 70 of file Config.cpp.

◆ getLinearConfig()

types::LinearConfig getLinearConfig ( const std::string  name)

Get a LinearConvertedValue typed Config attribute by name.

Parameters
namethe name of this Config attribute
Exceptions
ConfigElementNotFoundErrorif there is no LinearConvertedValue to this key
Returns
the value

Definition at line 34 of file Config.cpp.

◆ getMatrix()

Eigen::Matrix<Type, Rows, Columns> getMatrix ( const std::string  name)
inline

Get a Matrix by name.

Parameters
namethe name of this Config attribute
Exceptions
ConfigElementNotFoundErrorif there is no matrix to this key with the correct type, width and height
Returns
the value

Definition at line 198 of file Config.h.

◆ getModularConvertedValueConfig()

types::ModularConvertedValueConfig getModularConvertedValueConfig ( const std::string &  name)

Get a ModularConvertedValue typed Config attribute by name.

Parameters
namethe name of this Config attribute
Exceptions
ConfigElementNotFoundErrorif there is no ModularConvertedValue to this key
Returns
the value

Definition at line 40 of file Config.cpp.

◆ getString()

std::string getString ( const std::string  name)

Get a String typed Config attribute by name.

Parameters
namethe name of this Config attribute
Exceptions
ConfigElementNotFoundErrorif there is no String value to this key
Returns
the value

Definition at line 46 of file Config.cpp.

◆ getUint()

std::uint32_t getUint ( const std::string  name)

Get a Uint (std::uint32_t) typed Config attribute by name.

Parameters
namethe name of this Config attribute
Exceptions
ConfigElementNotFoundErrorif there is no Uint value to this key
Returns
the value

Definition at line 22 of file Config.cpp.

◆ getUintList()

std::list< std::uint32_t > getUintList ( const std::string  name)

Get a UIntList (std::list<std::uint32_t>) typed Config attribute by name.

Parameters
namethe name of this Config attribute
Exceptions
ConfigElementNotFoundErrorif there is no UIntList value to this key
Returns
the value

Definition at line 64 of file Config.cpp.

◆ onParsingFinished()

void onParsingFinished ( )
virtual

This method is called when the config is completely read form the HardwareConfig file.

It starts the tracking of which item is read from this Config object.

Reimplemented in DeviceConfig, and SlaveConfig.

Definition at line 316 of file Config.cpp.

+ Here is the caller graph for this function:

◆ print()

void print ( std::stringstream &  s,
int  indention 
) const
virtual

Print this configuration.

Works recursively.

Parameters
sthe stream to append the output to
indentionthe indentation (=level of recursion)

Reimplemented in DeviceConfig, SlaveConfig, and DeviceConfigBase.

Definition at line 121 of file Config.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set()

void set ( const std::string  name,
T  value,
ConfigTag  tag 
)
inlineprotected

Definition at line 268 of file Config.h.

+ Here is the call graph for this function:

◆ setBool()

void setBool ( const std::string  name,
bool  value,
ConfigTag  tag 
)
protected

Definition at line 205 of file Config.cpp.

+ Here is the call graph for this function:

◆ setBoolList()

void setBoolList ( const std::string  name,
std::list< bool >  value,
ConfigTag  tag 
)
protected

Definition at line 249 of file Config.cpp.

+ Here is the call graph for this function:

◆ setFloat()

void setFloat ( const std::string  name,
float  value,
ConfigTag  tag 
)
protected

Definition at line 211 of file Config.cpp.

+ Here is the call graph for this function:

◆ setFloatList()

void setFloatList ( const std::string  name,
std::list< float value,
ConfigTag  tag 
)
protected

Definition at line 255 of file Config.cpp.

+ Here is the call graph for this function:

◆ setInt()

void setInt ( const std::string  name,
std::int32_t  value,
ConfigTag  tag 
)
protected

Definition at line 223 of file Config.cpp.

+ Here is the call graph for this function:

◆ setIntList()

void setIntList ( const std::string  name,
std::list< std::int32_t >  value,
ConfigTag  tag 
)
protected

Definition at line 267 of file Config.cpp.

+ Here is the call graph for this function:

◆ setLinearConfig()

void setLinearConfig ( const std::string  name,
types::LinearConfig &&  value,
ConfigTag  tag 
)
protected

Definition at line 229 of file Config.cpp.

+ Here is the call graph for this function:

◆ setModularConvertedValueConfig()

void setModularConvertedValueConfig ( const std::string  name,
types::ModularConvertedValueConfig &&  value,
ConfigTag  tag 
)
protected

Definition at line 235 of file Config.cpp.

+ Here is the call graph for this function:

◆ setString()

void setString ( const std::string  name,
std::string  value,
ConfigTag  tag 
)
protected

Definition at line 243 of file Config.cpp.

+ Here is the call graph for this function:

◆ setUint()

void setUint ( const std::string  name,
std::uint32_t  value,
ConfigTag  tag 
)
protected

Definition at line 217 of file Config.cpp.

+ Here is the call graph for this function:

◆ setUintList()

void setUintList ( const std::string  name,
std::list< std::uint32_t >  value,
ConfigTag  tag 
)
protected

Definition at line 261 of file Config.cpp.

+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ ConfigParser

friend class ConfigParser
friend

Definition at line 93 of file Config.h.

◆ ControllerConfig

friend class ControllerConfig
friend

Definition at line 94 of file Config.h.

Member Data Documentation

◆ items

std::map<std::string, ConfigItemWithMetadata> items
protected

Definition at line 250 of file Config.h.


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