mc_rtc::Configuration Struct Reference

Simplify access to values hold within a JSON file. More...

#include <mc_rtc/Configuration.h>

Inheritance diagram for mc_rtc::Configuration:

Classes

struct  Exception
 Exception thrown by this class when something bad occurs. More...
 

Public Member Functions

MC_RTC_DEPRECATED bool isMember (const std::string &key) const
 Deprecated, see has. More...
 
bool has (const std::string &key) const
 Check if the key is part of the conf. More...
 
 operator bool () const
 Cast to bool. More...
 
 operator int8_t () const
 Cast to int8_t. More...
 
 operator uint8_t () const
 Cast to uint8_t. More...
 
 operator int16_t () const
 Cast to int16_t. More...
 
 operator uint16_t () const
 Cast to uint16_t. More...
 
 operator int32_t () const
 Cast to int32_t. More...
 
 operator uint32_t () const
 Cast to uint32_t. More...
 
 operator int64_t () const
 Cast to int64_t. More...
 
 operator uint64_t () const
 Cast to uint64_t. More...
 
 operator double () const
 Cast to double. More...
 
 operator std::string () const
 Cast to a string. More...
 
 operator Eigen::Vector2d () const
 Retrieve as a Eigen::Vector2d instance. More...
 
 operator Eigen::Vector3d () const
 Retrieve as a Eigen::Vector3d instance. More...
 
 operator Eigen::Vector4d () const
 Retrieve as a Eigen::Vector4d instance. More...
 
 operator Eigen::Vector6d () const
 Retrieve as a Eigen::Vector6d instance. More...
 
 operator mc_rbdyn::Gains2d () const
 Retrieve as a mc_rbdyn::Gains2d instance. More...
 
 operator mc_rbdyn::Gains3d () const
 Retrieve as a mc_rbdyn::Gains3d instance. More...
 
 operator mc_rbdyn::Gains6d () const
 Retrieve as a mc_rbdyn::Gains6d instance. More...
 
 operator Eigen::VectorXd () const
 Retrieve as a Eigen::VectorXd instance. More...
 
 operator Eigen::Quaterniond () const
 Retrieve as a Eigen::Quaterniond instance. More...
 
 operator Eigen::Matrix3d () const
 Retrieve as a Eigen::Matrix3d instance. More...
 
 operator Eigen::Matrix6d () const
 Retrieve as a Eigen::Matrix6d instance. More...
 
 operator Eigen::MatrixXd () const
 Retrieve as a Eigen::MatrixXd instance. More...
 
 operator sva::PTransformd () const
 Retrieve as an sva::PTransformd. More...
 
 operator sva::ForceVecd () const
 Retrieve as an sva::ForceVecd. More...
 
 operator sva::MotionVecd () const
 Retrieve as an sva::MotionVecd. More...
 
 operator sva::ImpedanceVecd () const
 Retrieve as an sva::ImpedanceVecd. More...
 
template<class T , class A >
 operator std::vector< T, A > () const
 Retrieve a vector instance. More...
 
template<class T , std::size_t N>
 operator std::array< T, N > () const
 Retrieve an array instance. More...
 
template<class T1 , class T2 >
 operator std::pair< T1, T2 > () const
 Retrieve a pair instance. More...
 
template<typename T , class C , class A >
 operator std::map< std::string, T, C, A > () const
 Retrieve a string-indexed map instance. More...
 
template<typename T , typename C = std::less<T>, typename A = std::allocator<T>>
 operator std::set< T, C, A > () const
 Retrieve a set of objects. More...
 
template<typename T , typename H = std::hash<T>, typename E = std::equal_to<T>, typename A = std::allocator<T>>
 operator std::unordered_set< T, H, E, A > () const
 Retrieve an unordered set of objects. More...
 
template<typename... Args>
 operator std::variant< Args... > () const
 
template<typename T , typename std::enable_if< internal::is_integral_v< T >, int >::type = 0>
 operator T () const
 
template<typename T , typename std::enable_if< internal::has_configuration_load_object_v< T >||internal::has_static_fromConfiguration_v< T >, int >::type = 0>
 operator T () const
 User-defined conversions. More...
 
template<typename T >
 operator std::optional< T > () const
 Retrieves an optional<T> More...
 
 Configuration ()
 Creates an empty configuration. More...
 
 Configuration (const std::string &path)
 Constructor using a file path. More...
 
 Configuration (const char *path)
 Constructor using a file path (C-style string) More...
 
void load (const std::string &path)
 Load more data into the configuration. More...
 
void load (const mc_rtc::Configuration &config)
 Load data from another Configuration object. More...
 
void loadData (const std::string &data)
 Load data from a JSON string. More...
 
void loadYAMLData (const std::string &data)
 Load data from a YAML string. More...
 
void save (const std::string &path, bool pretty=true) const
 Save the configuration to a file. More...
 
std::string dump (bool pretty=false, bool yaml=false) const
 Dump the configuration into a string. More...
 
size_t toMessagePack (std::vector< char > &data) const
 Convert to MessagePack. More...
 
void toMessagePack (MessagePackBuilder &builder) const
 Append to an existing MessagePackBuilder. More...
 
Configuration operator() (const std::string &key) const
 Returns a Entry value stored within the configuration. More...
 
std::optional< Configurationfind (const std::string &key) const
 Returns the Configuration entry if it exists, std::nullopt otherwise. More...
 
template<typename... Args>
std::optional< Configurationfind (const std::string &key, Args &&... others) const
 Return the Configuration entry at (key, others...) if it exists, std::nullopt otherwise. More...
 
template<typename T , typename... Args>
std::optional< T > find (const std::string &key, Args &&... others) const
 Return the Configuration entry at (key, others...) if it exists, std::nullopt otherwise. More...
 
bool empty () const
 Returns true if the underlying array or underlying object is empty. More...
 
size_t size () const
 If the stored value is an array, returns its size, otherwise returns 0. More...
 
bool isArray () const noexcept
 Returns true if the underlying value is an array. More...
 
bool isObject () const noexcept
 Returns true if the underlying value is an object. More...
 
bool isString () const noexcept
 Returns true if the underlying value is a string. More...
 
bool isNumeric () const noexcept
 Returns true if the underlying value is numeric. More...
 
Configuration operator[] (size_t i) const
 If the stored value is an array, return a Configuration element for the i-th element. More...
 
template<typename T >
at (size_t i, const T &v) const
 Retrieve a given value from a JSON array. More...
 
template<typename T >
void operator() (const std::string &key, T &v) const
 Retrieve and store a given value stored within the configuration. More...
 
template<typename T >
operator() (const std::string &key, const T &v) const
 Retrieve a given value stored within the configuration with a default value. More...
 
bool operator== (const char *rhs) const
 Non-template version for C-style strings comparison. More...
 
template<typename T >
bool operator== (const T &rhs) const
 Compare stored values with given value. More...
 
void add_null (const std::string &key)
 Add a null element to the configuration. More...
 
void add (const std::string &key, bool value)
 Add a bool element to the Configuration. More...
 
void add (const std::string &key, int8_t value)
 Add a int64_t element to the Configuration. More...
 
void add (const std::string &key, uint8_t value)
 Add a uint8_t element to the Configuration. More...
 
void add (const std::string &key, int16_t value)
 Add a int16_t element to the Configuration. More...
 
void add (const std::string &key, uint16_t value)
 Add a uint16_t element to the Configuration. More...
 
void add (const std::string &key, int32_t value)
 Add a int32_t element to the Configuration. More...
 
void add (const std::string &key, uint32_t value)
 Add a uint32_t element to the Configuration. More...
 
void add (const std::string &key, int64_t value)
 Add a int64_t element to the Configuration. More...
 
void add (const std::string &key, uint64_t value)
 Add a uint64_t element to the Configuration. More...
 
void add (const std::string &key, double value)
 Add a double element to the Configuration. More...
 
void add (const std::string &key, const std::string &value)
 Add a std::string element to the Configuration. More...
 
void add (const std::string &key, const char *value)
 Add a const char* element to the Configuration, Behaves like std::string. More...
 
void add (const std::string &key, const Eigen::Vector2d &value)
 Add a Eigen::Vector2d element to the Configuration. More...
 
void add (const std::string &key, const Eigen::Vector3d &value)
 Add a Eigen::Vector3d element to the Configuration. More...
 
void add (const std::string &key, const Eigen::Vector4d &value)
 Add a Eigen::Vector4d element to the Configuration. More...
 
void add (const std::string &key, const Eigen::Vector6d &value)
 Add a Eigen::Vector6d element to the Configuration. More...
 
void add (const std::string &key, const Eigen::VectorXd &value)
 Add a Eigen::VectorXd element to the Configuration. More...
 
void add (const std::string &key, const Eigen::Quaterniond &value)
 Add a Eigen::Quaterniond element to the Configuration. More...
 
void add (const std::string &key, const Eigen::Matrix3d &value)
 Add a Eigen::Matrix3d element to the Configuration. More...
 
void add (const std::string &key, const Eigen::Matrix6d &value)
 Add a Eigen::Matrix6d element to the Configuration. More...
 
void add (const std::string &key, const Eigen::MatrixXd &value)
 Add an Eigen::MatrixXd element to the Configuration. More...
 
void add (const std::string &key, const sva::PTransformd &value)
 Add an sva::PTransformd element to the Configuration. More...
 
void add (const std::string &key, const sva::ForceVecd &value)
 Add an sva::ForceVecd element to the Configuration. More...
 
void add (const std::string &key, const sva::MotionVecd &value)
 Add an sva::MotionVecd element to the Configuration. More...
 
void add (const std::string &key, const sva::ImpedanceVecd &value)
 Add an sva::ImpedanceVecd element to the Configuration. More...
 
void add (const std::string &key, const Configuration &value)
 Add another Configuration to the Configuration. More...
 
Configuration add (const std::string &key)
 Create an empty object in the Configuration. More...
 
Configuration array (const std::string &key, size_t size=0)
 Create an empty array in the Configuration. More...
 
void push_null ()
 Insert a null value into an array. More...
 
void push (bool value)
 Insert a bool element into an array. More...
 
void push (int8_t value)
 Insert a int8_t element int8_to an array. More...
 
void push (uint8_t value)
 Insert a uint8_t element into an array. More...
 
void push (int16_t value)
 Insert a int16_t element int16_to an array. More...
 
void push (uint16_t value)
 Insert a uint16_t element into an array. More...
 
void push (int32_t value)
 Insert a int32_t element int32_to an array. More...
 
void push (uint32_t value)
 Insert a uint32_t element into an array. More...
 
void push (int64_t value)
 Insert a int64_t element int64_to an array. More...
 
void push (uint64_t value)
 Insert a uint64_t element into an array. More...
 
void push (double value)
 Insert a double element into an array. More...
 
void push (const std::string &value)
 Insert a std::string element into an array. More...
 
void push (const char *value)
 Insert a const char * element into an array Behaves like push(std::string) More...
 
void push (const Eigen::Vector2d &value)
 Insert a Eigen::Vector2d element into an array. More...
 
void push (const Eigen::Vector3d &value)
 Insert a Eigen::Vector3d element into an array. More...
 
void push (const Eigen::Vector4d &value)
 Insert a Eigen::Vector4d element into an array. More...
 
void push (const Eigen::Vector6d &value)
 Insert a Eigen::Vector6d element into an array. More...
 
void push (const Eigen::VectorXd &value)
 Insert a Eigen::VectorXd element into an array. More...
 
void push (const Eigen::Quaterniond &value)
 Insert a Eigen::Quaterniond element into an array. More...
 
void push (const Eigen::Matrix3d &value)
 Insert a Eigen::Matrix3d element into an array. More...
 
void push (const Eigen::Matrix6d &value)
 Insert a Eigen::Matrix6d element into an array. More...
 
void push (const Eigen::MatrixXd &value)
 Insert a Eigen::MatrixXd element into an array. More...
 
void push (const sva::PTransformd &value)
 Insert an sva::PTransformd element into an array. More...
 
void push (const sva::ForceVecd &value)
 Insert an sva::ForceVecd element into an array. More...
 
void push (const sva::MotionVecd &value)
 Insert an sva::MotionVecd element into an array. More...
 
void push (const sva::ImpedanceVecd &value)
 Insert an sva::ImpedanceVecd element into an array. More...
 
void push (const Configuration &value)
 Push a Configuration element into an array. More...
 
Configuration array (size_t reserve=0)
 Push an empty array. More...
 
Configuration object ()
 Push an empty object. More...
 
template<typename T , typename... Args, typename std::enable_if< internal::has_configuration_save_object_v< T, Args... >||internal::has_toConfiguration_method_v< T, Args... >, int >::type = 0>
void push (const T &value, Args &&... args)
 User-defined conversion. More...
 
template<typename T , typename std::enable_if< internal::is_integral_v< T >, int >::type = 0>
void push (const T &value)
 
template<typename T , typename A = std::allocator<T>, typename... Args>
void add (const std::string &key, const std::vector< T, A > &value, Args &&... args)
 Add a vector into the JSON document. More...
 
template<typename T , std::size_t N, typename... Args>
void add (const std::string &key, const std::array< T, N > &value, Args &&... args)
 Add an array into the JSON document. More...
 
template<typename T1 , typename T2 , typename... Args>
void add (const std::string &key, const std::pair< T1, T2 > &value, Args &&... args)
 Add a pair into the JSON document. More...
 
template<typename T , class C = std::less<std::string>, class A = std::allocator<std::pair<const std::string, T>>, typename... Args>
void add (const std::string &key, const std::map< std::string, T, C, A > &value, Args &&... args)
 Add string-indexed map into the JSON document. More...
 
template<typename T , typename C = std::less<T>, typename A = std::allocator<T>, typename... Args>
void add (const std::string &key, const std::set< T, C, A > &value, Args &&... args)
 Add a set into the JSON document. More...
 
template<typename T , typename H = std::hash<T>, typename E = std::equal_to<T>, typename A = std::allocator<T>, typename... Args>
void add (const std::string &key, const std::unordered_set< T, H, E, A > &value, Args &&... args)
 Add an unordered set into the JSON document. More...
 
template<typename... Args>
void add (const std::string &key, const std::variant< Args... > &value)
 Add a variant object into the JSON document. More...
 
template<typename T , typename std::enable_if< internal::is_integral_v< T >, int >::type = 0>
void add (const std::string &key, const T &value)
 
template<typename T , typename... Args, typename std::enable_if< internal::has_configuration_save_object_v< T, Args... >||internal::has_toConfiguration_method_v< T, Args... >, int >::type = 0>
void add (const std::string &key, const T &value, Args &&... args)
 User-defined conversion. More...
 
template<typename T , typename A = std::allocator<T>, typename... Args>
void push (const std::vector< T, A > &value, Args &&... args)
 Push a vector into the JSON document. More...
 
template<typename T , std::size_t N, typename... Args>
void push (const std::array< T, N > &value, Args &&... args)
 Push an array into the JSON document. More...
 
template<typename T1 , typename T2 , typename... Args>
void push (const std::pair< T1, T2 > &value, Args &&... args)
 Push a pair into the JSON document. More...
 
template<typename T , class C = std::less<std::string>, class A = std::allocator<std::pair<const std::string, T>>, typename... Args>
void push (const std::map< std::string, T, C, A > &value, Args &&... args)
 Push a string-indexed map into the JSON document. More...
 
template<typename T , typename C = std::less<T>, typename A = std::allocator<T>, typename... Args>
void push (const std::set< T, C, A > &value, Args &&... args)
 Push a set into the JSON document. More...
 
template<typename T , typename H = std::hash<T>, typename E = std::equal_to<T>, typename A = std::allocator<T>, typename... Args>
void push (const std::unordered_set< T, H, E, A > &value, Args &&... args)
 Push an unordered set into the JSON document. More...
 
template<typename... Args>
void push (const std::variant< Args... > &value)
 Push a variant object into the JSON document. More...
 
bool remove (const std::string &key)
 
std::vector< std::string > keys () const
 
ConfigurationArrayIterator begin () const
 
ConfigurationArrayIterator end () const
 
template<>
void MC_RTC_UTILS_DLLAPI operator() (const std::string &key, std::string &v) const
 Specialized version to lift ambiguity. More...
 

Static Public Member Functions

static Configuration rootArray ()
 Returns a Configuration with an array as root entry. More...
 
static Configuration fromData (const std::string &data)
 Static constructor to load from JSON data. More...
 
static Configuration fromData (const char *data)
 Static constructor to load from JSON data (C overload) More...
 
static Configuration fromYAMLData (const std::string &data)
 Static constructor to load from YAML data. More...
 
static Configuration fromYAMLData (const char *data)
 Static constructor to load from YAML data (C overload) More...
 
static Configuration fromMessagePack (const char *data, size_t size)
 Static constructor to load from MessagePack data. More...
 

Detailed Description

Simplify access to values hold within a JSON file.

Configuration values can be accessed using a key system, type conversion are ensured by the class.

Constructor & Destructor Documentation

◆ Configuration() [1/3]

mc_rtc::Configuration::Configuration ( )

Creates an empty configuration.

◆ Configuration() [2/3]

mc_rtc::Configuration::Configuration ( const std::string &  path)

Constructor using a file path.

Parameters
pathPath to the configuration file

◆ Configuration() [3/3]

mc_rtc::Configuration::Configuration ( const char *  path)

Constructor using a file path (C-style string)

Parameters
pathPath to the configuration file

Member Function Documentation

◆ add() [1/36]

Configuration mc_rtc::Configuration::add ( const std::string &  key)

Create an empty object in the Configuration.

Overwrite existing content if any.

Parameters
keyKey to add

◆ add() [2/36]

void mc_rtc::Configuration::add ( const std::string &  key,
bool  value 
)

Add a bool element to the Configuration.

Overrides the existing value if it holds one for the given key.

Parameters
keyKey of the element
valueValue of the element

◆ add() [3/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const char *  value 
)

Add a const char* element to the Configuration, Behaves like std::string.

See also
add(const std::string&, bool)

◆ add() [4/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const Configuration value 
)

◆ add() [5/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const Eigen::Matrix3d &  value 
)

Add a Eigen::Matrix3d element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [6/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const Eigen::Matrix6d &  value 
)

Add a Eigen::Matrix6d element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [7/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const Eigen::MatrixXd &  value 
)

Add an Eigen::MatrixXd element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [8/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const Eigen::Quaterniond &  value 
)

Add a Eigen::Quaterniond element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [9/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const Eigen::Vector2d &  value 
)

Add a Eigen::Vector2d element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [10/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const Eigen::Vector3d &  value 
)

Add a Eigen::Vector3d element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [11/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const Eigen::Vector4d &  value 
)

Add a Eigen::Vector4d element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [12/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const Eigen::Vector6d &  value 
)

Add a Eigen::Vector6d element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [13/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const Eigen::VectorXd &  value 
)

Add a Eigen::VectorXd element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [14/36]

template<typename T , std::size_t N, typename... Args>
void mc_rtc::Configuration::add ( const std::string &  key,
const std::array< T, N > &  value,
Args &&...  args 
)
inline

Add an array into the JSON document.

Overwrites existing content if any.

Parameters
keyKey of the element
valueArray of elements to add

◆ add() [15/36]

template<typename T , class C = std::less<std::string>, class A = std::allocator<std::pair<const std::string, T>>, typename... Args>
void mc_rtc::Configuration::add ( const std::string &  key,
const std::map< std::string, T, C, A > &  value,
Args &&...  args 
)
inline

Add string-indexed map into the JSON document.

Overwrites existing content if any.

Parameters
keyKey of the element
valueMap of elements to add

◆ add() [16/36]

template<typename T1 , typename T2 , typename... Args>
void mc_rtc::Configuration::add ( const std::string &  key,
const std::pair< T1, T2 > &  value,
Args &&...  args 
)
inline

Add a pair into the JSON document.

Overwrite existing content if any.

Parameters
keyKey of the element
valuePair to add

◆ add() [17/36]

template<typename T , typename C = std::less<T>, typename A = std::allocator<T>, typename... Args>
void mc_rtc::Configuration::add ( const std::string &  key,
const std::set< T, C, A > &  value,
Args &&...  args 
)
inline

Add a set into the JSON document.

Overwrites existing content if any.

Parameters
keyKey of the element
valueSet of elements to add

◆ add() [18/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const std::string &  value 
)

Add a std::string element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [19/36]

template<typename T , typename H = std::hash<T>, typename E = std::equal_to<T>, typename A = std::allocator<T>, typename... Args>
void mc_rtc::Configuration::add ( const std::string &  key,
const std::unordered_set< T, H, E, A > &  value,
Args &&...  args 
)
inline

Add an unordered set into the JSON document.

Overwrites existing content if any.

Parameters
keyKey of the element
valueSet of elements to add

◆ add() [20/36]

template<typename... Args>
void mc_rtc::Configuration::add ( const std::string &  key,
const std::variant< Args... > &  value 
)
inline

Add a variant object into the JSON document.

The variant is written as [value.index(), std::get<value.index()>(value)]

Exceptions
Ifthe variant is in valueless state
Parameters
keyKey of the element
valueVariant value to add

◆ add() [21/36]

template<typename T , typename A = std::allocator<T>, typename... Args>
void mc_rtc::Configuration::add ( const std::string &  key,
const std::vector< T, A > &  value,
Args &&...  args 
)
inline

Add a vector into the JSON document.

Overwrites existing content if any.

Parameters
keyKey of the element
valueVector of elements to add

◆ add() [22/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const sva::ForceVecd &  value 
)

Add an sva::ForceVecd element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [23/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const sva::ImpedanceVecd &  value 
)

Add an sva::ImpedanceVecd element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [24/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const sva::MotionVecd &  value 
)

Add an sva::MotionVecd element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [25/36]

void mc_rtc::Configuration::add ( const std::string &  key,
const sva::PTransformd &  value 
)

Add an sva::PTransformd element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [26/36]

template<typename T , typename std::enable_if< internal::is_integral_v< T >, int >::type = 0>
void mc_rtc::Configuration::add ( const std::string &  key,
const T &  value 
)
inline

Integral type conversions

Parameters
Keykey of the element
valueValue to add

◆ add() [27/36]

template<typename T , typename... Args, typename std::enable_if< internal::has_configuration_save_object_v< T, Args... >||internal::has_toConfiguration_method_v< T, Args... >, int >::type = 0>
void mc_rtc::Configuration::add ( const std::string &  key,
const T &  value,
Args &&...  args 
)
inline

User-defined conversion.

Requires the existence of: mc_rtc::Configuration mc_rtc::ConfigurationLoader<T>::save(const T&, Args ... args);

Parameters
keyKey of the element
valueValue to add

◆ add() [28/36]

void mc_rtc::Configuration::add ( const std::string &  key,
double  value 
)

Add a double element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [29/36]

void mc_rtc::Configuration::add ( const std::string &  key,
int16_t  value 
)

Add a int16_t element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [30/36]

void mc_rtc::Configuration::add ( const std::string &  key,
int32_t  value 
)

Add a int32_t element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [31/36]

void mc_rtc::Configuration::add ( const std::string &  key,
int64_t  value 
)

Add a int64_t element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [32/36]

void mc_rtc::Configuration::add ( const std::string &  key,
int8_t  value 
)

Add a int64_t element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [33/36]

void mc_rtc::Configuration::add ( const std::string &  key,
uint16_t  value 
)

Add a uint16_t element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [34/36]

void mc_rtc::Configuration::add ( const std::string &  key,
uint32_t  value 
)

Add a uint32_t element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [35/36]

void mc_rtc::Configuration::add ( const std::string &  key,
uint64_t  value 
)

Add a uint64_t element to the Configuration.

See also
add(const std::string&, bool)

◆ add() [36/36]

void mc_rtc::Configuration::add ( const std::string &  key,
uint8_t  value 
)

Add a uint8_t element to the Configuration.

See also
add(const std::string&, bool)

◆ add_null()

void mc_rtc::Configuration::add_null ( const std::string &  key)

Add a null element to the configuration.

Overrides the existing value if it holds one for the given key

Parameters
keyKey of the element

◆ array() [1/2]

Configuration mc_rtc::Configuration::array ( const std::string &  key,
size_t  size = 0 
)

Create an empty array in the Configuration.

Overwrite existing content if any.

Parameters
keyKey to add
sizeSize that is reserved for the array

◆ array() [2/2]

Configuration mc_rtc::Configuration::array ( size_t  reserve = 0)

Push an empty array.

See also
push(bool);

◆ at()

template<typename T >
T mc_rtc::Configuration::at ( size_t  i,
const T &  v 
) const
inline

Retrieve a given value from a JSON array.

Returns the default value if the index is too high or if the underlying value does not match the requested type.

Parameters
iIndex to retrieve
vThe default value

◆ begin()

ConfigurationArrayIterator mc_rtc::Configuration::begin ( ) const

◆ dump()

std::string mc_rtc::Configuration::dump ( bool  pretty = false,
bool  yaml = false 
) const

Dump the configuration into a string.

Parameters
prettyWrites a human-readable string, defaults to false
yamlWrites YAML instead of JSON, defaults to false

◆ empty()

bool mc_rtc::Configuration::empty ( ) const

Returns true if the underlying array or underlying object is empty.

◆ end()

ConfigurationArrayIterator mc_rtc::Configuration::end ( ) const

◆ find() [1/3]

std::optional<Configuration> mc_rtc::Configuration::find ( const std::string &  key) const

Returns the Configuration entry if it exists, std::nullopt otherwise.

Parameters
keykey used to store the value
Returns
Configuration entry if it exists, std::nullopt otherwise

◆ find() [2/3]

template<typename... Args>
std::optional<Configuration> mc_rtc::Configuration::find ( const std::string &  key,
Args &&...  others 
) const
inline

Return the Configuration entry at (key, others...) if it exists, std::nullopt otherwise.

This is equivalent if(auto a = cfg.find("a")) { if(auto b = cfg.find("b")) { ... } }

Parameters
keykey used to store the value
othersKeys searched one after the other
Returns
Configuration entry if it exists, std::nullopt otherwise

◆ find() [3/3]

template<typename T , typename... Args>
std::optional<T> mc_rtc::Configuration::find ( const std::string &  key,
Args &&...  others 
) const
inline

Return the Configuration entry at (key, others...) if it exists, std::nullopt otherwise.

Parameters
keykey used to store the value
othersKeys searched one after the other
Template Parameters
TType of the entry retrieved
Exceptions
Ifthe key exists but the conversion to
Template Parameters
Tfails

◆ fromData() [1/2]

static Configuration mc_rtc::Configuration::fromData ( const char *  data)
static

Static constructor to load from JSON data (C overload)

Parameters
dataJSON data to load

◆ fromData() [2/2]

static Configuration mc_rtc::Configuration::fromData ( const std::string &  data)
static

Static constructor to load from JSON data.

Parameters
dataJSON data to load

◆ fromMessagePack()

static Configuration mc_rtc::Configuration::fromMessagePack ( const char *  data,
size_t  size 
)
static

Static constructor to load from MessagePack data.

Parameters
dataMessagePack data to load
sizeSize of data

◆ fromYAMLData() [1/2]

static Configuration mc_rtc::Configuration::fromYAMLData ( const char *  data)
static

Static constructor to load from YAML data (C overload)

Parameters
dataYAML data to load

◆ fromYAMLData() [2/2]

static Configuration mc_rtc::Configuration::fromYAMLData ( const std::string &  data)
static

Static constructor to load from YAML data.

Parameters
dataYAML data to load

◆ has()

bool mc_rtc::Configuration::has ( const std::string &  key) const

Check if the key is part of the conf.

Parameters
keyThe key to test
Returns
True if key is part of the configuration

◆ isArray()

bool mc_rtc::Configuration::isArray ( ) const
inlinenoexcept

Returns true if the underlying value is an array.

◆ isMember()

MC_RTC_DEPRECATED bool mc_rtc::Configuration::isMember ( const std::string &  key) const

Deprecated, see has.

Parameters
keyThe key to test
Returns
True if key is part of the configuration

◆ isNumeric()

bool mc_rtc::Configuration::isNumeric ( ) const
inlinenoexcept

Returns true if the underlying value is numeric.

◆ isObject()

bool mc_rtc::Configuration::isObject ( ) const
inlinenoexcept

Returns true if the underlying value is an object.

◆ isString()

bool mc_rtc::Configuration::isString ( ) const
inlinenoexcept

Returns true if the underlying value is a string.

◆ keys()

std::vector<std::string> mc_rtc::Configuration::keys ( ) const

Returns the keys of the JSON objects

Returns an empty vector if the underlying JSON object is not an object

◆ load() [1/2]

void mc_rtc::Configuration::load ( const mc_rtc::Configuration config)

Load data from another Configuration object.

For any key existing in both objects:

  • (*this)(key) is overwritten for values and arrays
  • if config(key) and (*this)(key) are objects, config(key) is loaded into (*this)(key)
  • otherwise, config(key) overwrites (*this)(key)
Parameters
configThe configuration object

◆ load() [2/2]

void mc_rtc::Configuration::load ( const std::string &  path)

Load more data into the configuration.

For any key existing in both objects:

  • (*this)(key) is overwritten for values and arrays
  • config(key) is loaded into (*this)(key) for objects
Parameters
pathPath to the configuration file

◆ loadData()

void mc_rtc::Configuration::loadData ( const std::string &  data)

Load data from a JSON string.

Same rules apply as ::load methods

Parameters
dataJSON data to load

◆ loadYAMLData()

void mc_rtc::Configuration::loadYAMLData ( const std::string &  data)

Load data from a YAML string.

Same rules apply as ::load methods

Parameters
dataYAML data to load

◆ object()

Configuration mc_rtc::Configuration::object ( )

Push an empty object.

See also
push(bool);

◆ operator bool()

mc_rtc::Configuration::operator bool ( ) const

Cast to bool.

Exceptions
Ifthe underlying value does not hold a boolean

◆ operator double()

mc_rtc::Configuration::operator double ( ) const

Cast to double.

Will actually convert any numeric entry into a double

Exceptions
Ifthe underlying value does not hold a numeric value

◆ operator Eigen::Matrix3d()

mc_rtc::Configuration::operator Eigen::Matrix3d ( ) const

Retrieve as a Eigen::Matrix3d instance.

Exceptions
Ifthe underlying value does not hold a numeric sequence of size 9

◆ operator Eigen::Matrix6d()

mc_rtc::Configuration::operator Eigen::Matrix6d ( ) const

Retrieve as a Eigen::Matrix6d instance.

Exceptions
Ifthe underlying value does not hold a numeric sequence of size 36

◆ operator Eigen::MatrixXd()

mc_rtc::Configuration::operator Eigen::MatrixXd ( ) const

Retrieve as a Eigen::MatrixXd instance.

Exceptions
Ifthe underlying value does not hold an array of array of numeric values

◆ operator Eigen::Quaterniond()

mc_rtc::Configuration::operator Eigen::Quaterniond ( ) const

Retrieve as a Eigen::Quaterniond instance.

Note
The sequence is normalized
Exceptions
Ifthe underlying value does not hold a numeric sequence of size 4

◆ operator Eigen::Vector2d()

mc_rtc::Configuration::operator Eigen::Vector2d ( ) const

Retrieve as a Eigen::Vector2d instance.

Exceptions
Ifthe underlying value does not hold a numeric sequence of size 2

◆ operator Eigen::Vector3d()

mc_rtc::Configuration::operator Eigen::Vector3d ( ) const

Retrieve as a Eigen::Vector3d instance.

Exceptions
Ifthe underlying value does not hold a numeric sequence of size 3

◆ operator Eigen::Vector4d()

mc_rtc::Configuration::operator Eigen::Vector4d ( ) const

Retrieve as a Eigen::Vector4d instance.

Exceptions
Ifthe underlying value does not hold a numeric sequence of size 4

◆ operator Eigen::Vector6d()

mc_rtc::Configuration::operator Eigen::Vector6d ( ) const

Retrieve as a Eigen::Vector6d instance.

Exceptions
Ifthe underlying value does not hold a numeric sequence of size 6

◆ operator Eigen::VectorXd()

mc_rtc::Configuration::operator Eigen::VectorXd ( ) const

Retrieve as a Eigen::VectorXd instance.

If the underlying value holds an empty sequence, this functions returns an empty (size 0) vector

Exceptions
Ifthe underlying value does not hold a numeric sequence

◆ operator int16_t()

mc_rtc::Configuration::operator int16_t ( ) const

Cast to int16_t.

Strictly for int16_t-typed entries

Exceptions
Ifthe underlying value does not hold an int16_t

◆ operator int32_t()

mc_rtc::Configuration::operator int32_t ( ) const

Cast to int32_t.

Strictly for int32_t-typed entries

Exceptions
Ifthe underlying value does not hold an int32_t

◆ operator int64_t()

mc_rtc::Configuration::operator int64_t ( ) const

Cast to int64_t.

Strictly for int64_t-typed entries

Exceptions
Ifthe underlying value does not hold an int64_t

◆ operator int8_t()

mc_rtc::Configuration::operator int8_t ( ) const

Cast to int8_t.

Strictly for int8_t-typed entries

Exceptions
Ifthe underlying value does not hold an int8_t

◆ operator mc_rbdyn::Gains2d()

mc_rtc::Configuration::operator mc_rbdyn::Gains2d ( ) const

Retrieve as a mc_rbdyn::Gains2d instance.

Exceptions
Ifthe underlying value is not a single double or a numeric sequence of size 2

◆ operator mc_rbdyn::Gains3d()

mc_rtc::Configuration::operator mc_rbdyn::Gains3d ( ) const

Retrieve as a mc_rbdyn::Gains3d instance.

Exceptions
Ifthe underlying value is not a single double or a numeric sequence of size 3

◆ operator mc_rbdyn::Gains6d()

mc_rtc::Configuration::operator mc_rbdyn::Gains6d ( ) const

Retrieve as a mc_rbdyn::Gains6d instance.

Exceptions
Ifthe underlying value is not a single double or a numeric sequence of size 6

◆ operator std::array< T, N >()

template<class T , std::size_t N>
mc_rtc::Configuration::operator std::array< T, N > ( ) const
inline

Retrieve an array instance.

Exceptions
Ifthe underlying value does not hold an array of the correct size or if any member of the array does not meet the requirements of the array elements' type.

◆ operator std::map< std::string, T, C, A >()

template<typename T , class C , class A >
mc_rtc::Configuration::operator std::map< std::string, T, C, A > ( ) const
inline

Retrieve a string-indexed map instance.

Exceptions
Ifthe underlying value is not an object or if the member of the object do not meet the requiremenent of the value type.

◆ operator std::optional< T >()

template<typename T >
mc_rtc::Configuration::operator std::optional< T > ( ) const
inlineexplicit

Retrieves an optional<T>

Returns nullopt if the conversion fails

◆ operator std::pair< T1, T2 >()

template<class T1 , class T2 >
mc_rtc::Configuration::operator std::pair< T1, T2 > ( ) const
inline

Retrieve a pair instance.

Exceptions
Ifthe underlying value does not hold an array of size 2 or if the member of the array do not meet the requirement of the pair type

◆ operator std::set< T, C, A >()

template<typename T , typename C = std::less<T>, typename A = std::allocator<T>>
mc_rtc::Configuration::operator std::set< T, C, A > ( ) const
inline

Retrieve a set of objects.

Exceptions
Ifthe underlying value is not an array, if the member of the array do not meet the requirement of the set key type or if the elements in the array are not unique

◆ operator std::string()

mc_rtc::Configuration::operator std::string ( ) const

Cast to a string.

Note
You may need explicit casting in some cases, e.g. writing a = config("entry") where a is a std::string instance requires explicit casting to compile. Alternatively, in this scenario, one can use config("entry", a) without explicit casting.
Exceptions
Ifthe underlying value does not hold a string

◆ operator std::unordered_set< T, H, E, A >()

template<typename T , typename H = std::hash<T>, typename E = std::equal_to<T>, typename A = std::allocator<T>>
mc_rtc::Configuration::operator std::unordered_set< T, H, E, A > ( ) const
inline

Retrieve an unordered set of objects.

Exceptions
Ifthe underlying value is not an array, if the member of the array do not meet the requirement of the set key type or if the elements in the array are not unique

◆ operator std::variant< Args... >()

template<typename... Args>
mc_rtc::Configuration::operator std::variant< Args... > ( ) const
inline

Retrieve a variant object

Exceptions
Ifthe underlying value is not an array of size 2
Ifthe first value of the array is an invalid index for this variant
Ifthe data in the second value of the array does not allow to deserialize a value of the type given at the index

◆ operator std::vector< T, A >()

template<class T , class A >
mc_rtc::Configuration::operator std::vector< T, A > ( ) const
inline

Retrieve a vector instance.

Exceptions
Ifthe underlying value does not hold an array or if any member of the array does not meeting the requirement of the vector elements' type

◆ operator sva::ForceVecd()

mc_rtc::Configuration::operator sva::ForceVecd ( ) const

Retrieve as an sva::ForceVecd.

Exceptions
Ifthe underlying value is not an object with couple and force members

◆ operator sva::ImpedanceVecd()

mc_rtc::Configuration::operator sva::ImpedanceVecd ( ) const

Retrieve as an sva::ImpedanceVecd.

Exceptions
Ifthe underlying value is not an object with angular and linear members

◆ operator sva::MotionVecd()

mc_rtc::Configuration::operator sva::MotionVecd ( ) const

Retrieve as an sva::MotionVecd.

Exceptions
Ifthe underlying value is not an object with angular and linear members

◆ operator sva::PTransformd()

mc_rtc::Configuration::operator sva::PTransformd ( ) const

Retrieve as an sva::PTransformd.

Exceptions
Ifthe underlying value is not an object with rotation and/or translation members

◆ operator T() [1/2]

template<typename T , typename std::enable_if< internal::is_integral_v< T >, int >::type = 0>
mc_rtc::Configuration::operator T ( ) const
inline

Integral type conversions

Exceptions
Ifthe cast to the similar standard integral type would fail

◆ operator T() [2/2]

template<typename T , typename std::enable_if< internal::has_configuration_load_object_v< T >||internal::has_static_fromConfiguration_v< T >, int >::type = 0>
mc_rtc::Configuration::operator T ( ) const
inline

User-defined conversions.

Requires:

◆ operator uint16_t()

mc_rtc::Configuration::operator uint16_t ( ) const

Cast to uint16_t.

Int entries that are strictly positive will be treated as uint16_t entries

Exceptions
Ifthe underlying value does not hold an uint16_t

◆ operator uint32_t()

mc_rtc::Configuration::operator uint32_t ( ) const

Cast to uint32_t.

Int entries that are strictly positive will be treated as uint32_t entries

Exceptions
Ifthe underlying value does not hold an uint32_t

◆ operator uint64_t()

mc_rtc::Configuration::operator uint64_t ( ) const

Cast to uint64_t.

Int entries that are strictly positive will be treated as uint64_t entries

Exceptions
Ifthe underlying value does not hold an uint64_t

◆ operator uint8_t()

mc_rtc::Configuration::operator uint8_t ( ) const

Cast to uint8_t.

Int entries that are strictly positive will be treated as uint8_t entries

Exceptions
Ifthe underlying value does not hold an uint8_t

◆ operator()() [1/4]

Configuration mc_rtc::Configuration::operator() ( const std::string &  key) const

Returns a Entry value stored within the configuration.

Parameters
keyThe key used to store the value
Returns
The Entry value stored in the configuration in the key entry
Exceptions
Ifkey is not stored in the Configuration

◆ operator()() [2/4]

template<typename T >
T mc_rtc::Configuration::operator() ( const std::string &  key,
const T &  v 
) const
inline

Retrieve a given value stored within the configuration with a default value.

If the key is not stored in the Configuration or if the underyling value does not match the requested type, the default value is returned.

Parameters
keyThe key used to store the value
vThe default value

◆ operator()() [3/4]

template<>
void MC_RTC_UTILS_DLLAPI mc_rtc::Configuration::operator() ( const std::string &  key,
std::string &  v 
) const

Specialized version to lift ambiguity.

◆ operator()() [4/4]

template<typename T >
void mc_rtc::Configuration::operator() ( const std::string &  key,
T &  v 
) const
inline

Retrieve and store a given value stored within the configuration.

If they key is not stored in the Configuration, the value is unchanged.

Parameters
keyThe key used to store the value
vThe value to retrieve

◆ operator==() [1/2]

bool mc_rtc::Configuration::operator== ( const char *  rhs) const

Non-template version for C-style strings comparison.

Returns
True if the comparison matches, false otherwise.

◆ operator==() [2/2]

template<typename T >
bool mc_rtc::Configuration::operator== ( const T &  rhs) const
inline

Compare stored values with given value.

Returns
True if the comparison matches, false otherwise.

◆ operator[]()

Configuration mc_rtc::Configuration::operator[] ( size_t  i) const

If the stored value is an array, return a Configuration element for the i-th element.

Parameters
iAccess i-th element
Exceptions
Ifi >= size()

◆ push() [1/35]

void mc_rtc::Configuration::push ( bool  value)

Insert a bool element into an array.

Parameters
valueValue to add
Exceptions
Ifthe underlying Json value is not an array.

◆ push() [2/35]

void mc_rtc::Configuration::push ( const char *  value)

Insert a const char * element into an array Behaves like push(std::string)

See also
push(bool);

◆ push() [3/35]

void mc_rtc::Configuration::push ( const Configuration value)

Push a Configuration element into an array.

See also
push(bool);

◆ push() [4/35]

void mc_rtc::Configuration::push ( const Eigen::Matrix3d &  value)

Insert a Eigen::Matrix3d element into an array.

See also
push(bool);

◆ push() [5/35]

void mc_rtc::Configuration::push ( const Eigen::Matrix6d &  value)

Insert a Eigen::Matrix6d element into an array.

See also
push(bool);

◆ push() [6/35]

void mc_rtc::Configuration::push ( const Eigen::MatrixXd &  value)

Insert a Eigen::MatrixXd element into an array.

See also
push(bool);

◆ push() [7/35]

void mc_rtc::Configuration::push ( const Eigen::Quaterniond &  value)

Insert a Eigen::Quaterniond element into an array.

See also
push(bool);

◆ push() [8/35]

void mc_rtc::Configuration::push ( const Eigen::Vector2d &  value)

Insert a Eigen::Vector2d element into an array.

See also
push(bool);

◆ push() [9/35]

void mc_rtc::Configuration::push ( const Eigen::Vector3d &  value)

Insert a Eigen::Vector3d element into an array.

See also
push(bool);

◆ push() [10/35]

void mc_rtc::Configuration::push ( const Eigen::Vector4d &  value)

Insert a Eigen::Vector4d element into an array.

See also
push(bool);

◆ push() [11/35]

void mc_rtc::Configuration::push ( const Eigen::Vector6d &  value)

Insert a Eigen::Vector6d element into an array.

See also
push(bool);

◆ push() [12/35]

void mc_rtc::Configuration::push ( const Eigen::VectorXd &  value)

Insert a Eigen::VectorXd element into an array.

See also
push(bool);

◆ push() [13/35]

template<typename T , std::size_t N, typename... Args>
void mc_rtc::Configuration::push ( const std::array< T, N > &  value,
Args &&...  args 
)
inline

Push an array into the JSON document.

Parameters
valueArray of elements to add

◆ push() [14/35]

template<typename T , class C = std::less<std::string>, class A = std::allocator<std::pair<const std::string, T>>, typename... Args>
void mc_rtc::Configuration::push ( const std::map< std::string, T, C, A > &  value,
Args &&...  args 
)
inline

Push a string-indexed map into the JSON document.

Parameters
valueMap of elements to add

◆ push() [15/35]

template<typename T1 , typename T2 , typename... Args>
void mc_rtc::Configuration::push ( const std::pair< T1, T2 > &  value,
Args &&...  args 
)
inline

Push a pair into the JSON document.

Parameters
valuePair of elements to add

◆ push() [16/35]

template<typename T , typename C = std::less<T>, typename A = std::allocator<T>, typename... Args>
void mc_rtc::Configuration::push ( const std::set< T, C, A > &  value,
Args &&...  args 
)
inline

Push a set into the JSON document.

Overwrites existing content if any.

Parameters
keyKey of the element
valueSet of elements to add

◆ push() [17/35]

void mc_rtc::Configuration::push ( const std::string &  value)

Insert a std::string element into an array.

See also
push(bool);

◆ push() [18/35]

template<typename T , typename H = std::hash<T>, typename E = std::equal_to<T>, typename A = std::allocator<T>, typename... Args>
void mc_rtc::Configuration::push ( const std::unordered_set< T, H, E, A > &  value,
Args &&...  args 
)
inline

Push an unordered set into the JSON document.

Overwrites existing content if any.

Parameters
keyKey of the element
valueSet of elements to add

◆ push() [19/35]

template<typename... Args>
void mc_rtc::Configuration::push ( const std::variant< Args... > &  value)
inline

Push a variant object into the JSON document.

The variant is written as [value.index(), std::get<value.index()>(value)]

Exceptions
Ifthe variant is in valueless state
Parameters
keyKey of the element
valueVariant value to add

◆ push() [20/35]

template<typename T , typename A = std::allocator<T>, typename... Args>
void mc_rtc::Configuration::push ( const std::vector< T, A > &  value,
Args &&...  args 
)
inline

Push a vector into the JSON document.

Parameters
valueVector of elements to add

◆ push() [21/35]

void mc_rtc::Configuration::push ( const sva::ForceVecd &  value)

Insert an sva::ForceVecd element into an array.

See also
push(bool)

◆ push() [22/35]

void mc_rtc::Configuration::push ( const sva::ImpedanceVecd &  value)

Insert an sva::ImpedanceVecd element into an array.

See also
push(bool)

◆ push() [23/35]

void mc_rtc::Configuration::push ( const sva::MotionVecd &  value)

Insert an sva::MotionVecd element into an array.

See also
push(bool)

◆ push() [24/35]

void mc_rtc::Configuration::push ( const sva::PTransformd &  value)

Insert an sva::PTransformd element into an array.

See also
push(bool)

◆ push() [25/35]

template<typename T , typename std::enable_if< internal::is_integral_v< T >, int >::type = 0>
void mc_rtc::Configuration::push ( const T &  value)
inline

Integral type conversions

Parameters
valueValue to push

◆ push() [26/35]

template<typename T , typename... Args, typename std::enable_if< internal::has_configuration_save_object_v< T, Args... >||internal::has_toConfiguration_method_v< T, Args... >, int >::type = 0>
void mc_rtc::Configuration::push ( const T &  value,
Args &&...  args 
)
inline

User-defined conversion.

Requires the existence of: mc_rtc::Configuration mc_rtc::ConfigurationLoader<T>::save(const T&, Args ...);

Parameters
valueValue to push

◆ push() [27/35]

void mc_rtc::Configuration::push ( double  value)

Insert a double element into an array.

See also
push(bool);

◆ push() [28/35]

void mc_rtc::Configuration::push ( int16_t  value)

Insert a int16_t element int16_to an array.

See also
push(bool);

◆ push() [29/35]

void mc_rtc::Configuration::push ( int32_t  value)

Insert a int32_t element int32_to an array.

See also
push(bool);

◆ push() [30/35]

void mc_rtc::Configuration::push ( int64_t  value)

Insert a int64_t element int64_to an array.

See also
push(bool);

◆ push() [31/35]

void mc_rtc::Configuration::push ( int8_t  value)

Insert a int8_t element int8_to an array.

See also
push(bool);

◆ push() [32/35]

void mc_rtc::Configuration::push ( uint16_t  value)

Insert a uint16_t element into an array.

See also
push(bool);

◆ push() [33/35]

void mc_rtc::Configuration::push ( uint32_t  value)

Insert a uint32_t element into an array.

See also
push(bool);

◆ push() [34/35]

void mc_rtc::Configuration::push ( uint64_t  value)

Insert a uint64_t element into an array.

See also
push(bool);

◆ push() [35/35]

void mc_rtc::Configuration::push ( uint8_t  value)

Insert a uint8_t element into an array.

See also
push(bool);

◆ push_null()

void mc_rtc::Configuration::push_null ( )

Insert a null value into an array.

Exceptions
Ifthe underlying Json value is not an array.

◆ remove()

bool mc_rtc::Configuration::remove ( const std::string &  key)

Remove a given element

Has no effect if the element is not present.

Parameters
keyElement to remove
Returns
True if the element was removed, false otherwise.

◆ rootArray()

static Configuration mc_rtc::Configuration::rootArray ( )
static

Returns a Configuration with an array as root entry.

This is not valid standard JSON

◆ save()

void mc_rtc::Configuration::save ( const std::string &  path,
bool  pretty = true 
) const

Save the configuration to a file.

If the path extension is yaml or yml then save in YAML format

Parameters
pathPath to the configuration file
prettyWrites a human-readable file, defaults to true

◆ size()

size_t mc_rtc::Configuration::size ( ) const

If the stored value is an array, returns its size, otherwise returns 0.

Returns
Size of the underlying array

◆ toMessagePack() [1/2]

void mc_rtc::Configuration::toMessagePack ( MessagePackBuilder builder) const

Append to an existing MessagePackBuilder.

The whole configuration will be stored in the MessagePack being built

Parameters
builderMessagePackBuilder instance

◆ toMessagePack() [2/2]

size_t mc_rtc::Configuration::toMessagePack ( std::vector< char > &  data) const

Convert to MessagePack.

Parameters
dataWill hold the message data
Returns
The size of the message, this is different from data.size()

The documentation for this struct was generated from the following file: