esp::core::config namespace

Configuration functionality.

Classes

class Configuration
This class holds Configuration data in a map of ConfigValues, and also supports nested Configurations via a map of smart pointers to this type.
class ConfigValue
This class uses an anonymous tagged union to store values of different types, as well as providing access to the values in a type safe manner.

Enums

enum class ConfigValType { Unknown = ID_UNDEFINED, Boolean, Integer, MagnumRad, MagnumDeg, Double, MagnumVec2, MagnumVec2i, _storedAsAPointer, MagnumVec3 = _storedAsAPointer, MagnumVec4, MagnumQuat, MagnumMat3, MagnumMat4, _nonTrivialTypes, String = _nonTrivialTypes }
This enum lists every type of value that can be currently stored directly in an esp::core::config::Configuration. All supported types should have entries in this enum class. All pointer-backed types (i.e. data larger than ConfigValue::_data array sizee) should have their enums placed after _storedAsAPointer tag. All non-trivial types should have their enums placed below _nonTrivialTypes tag. Any small, trivially copyable types should be placed before _storedAsAPointer tag.
enum ConfigValStatus: uint64_t { isDefault = 1ULL << 32, isHidden = 1ULL << 33, isTranslated = 1ULL << 34, reqsFuzzyComparison = 1ULL << 35 }
This enum lists the bit flags describing the various states ConfigValue can be in or characteristics they may have. These mask the higher order DWORD of _typeAndFlags, and so begin on bit 32 of 0-63.

Functions

void initConfigBindings(pybind11::module& m)
Specify bindings for esp::core::config::Configuration.
auto getNameForStoredType(const ConfigValType& value) -> std::string
Retrieve a string description of the passed ConfigValType enum value.
auto isConfigValTypePointerBased(ConfigValType type) -> bool constexpr
Quick check to see if type is stored as a pointer in the data or not (i.e. the type is trivially copyable or not)
auto isConfigValTypeNonTrivial(ConfigValType type) -> bool constexpr
Quick check to see if type is trivially copyable or not.
template<typename T>
auto useFuzzyComparisonFor() -> bool constexpr
Function template to return whether the value requires fuzzy comparison or not.
template<>
auto useFuzzyComparisonFor<double>() -> bool constexpr
Specify that ConfigValType::Double scalar floating point values require fuzzy comparison.
template<typename T>
auto configValTypeFor() -> ConfigValType constexpr
Function template to return type enum for specified type. All supported types should have a specialization of this function handling their type to ConfigValType enum tags mapping.
template<>
auto configValTypeFor<bool>() -> ConfigValType constexpr
Returns ConfigValType::Boolean type enum for specified type.
template<>
auto configValTypeFor<int>() -> ConfigValType constexpr
Returns ConfigValType::Integer type enum for specified type.
template<>
auto configValTypeFor<Mn::Rad>() -> ConfigValType constexpr
Returns ConfigValType::MagnumRad type enum for specified type.
template<>
auto configValTypeFor<Mn::Deg>() -> ConfigValType constexpr
Returns ConfigValType::MagnumDeg type enum for specified type.
template<>
auto configValTypeFor<double>() -> ConfigValType constexpr
Returns ConfigValType::Double type enum for specified type.
template<>
auto configValTypeFor<Mn::Vector2>() -> ConfigValType constexpr
Returns ConfigValType::MagnumVec2 type enum for specified type.
template<>
auto configValTypeFor<Mn::Vector2i>() -> ConfigValType constexpr
Returns ConfigValType::MagnumVec2i type enum for specified type.
template<>
auto configValTypeFor<Mn::Vector3>() -> ConfigValType constexpr
Returns ConfigValType::MagnumVec3 type enum for specified type.
template<>
auto configValTypeFor<Mn::Color3>() -> ConfigValType constexpr
Returns ConfigValType::MagnumVec3 type enum for specified type.
template<>
auto configValTypeFor<Mn::Vector4>() -> ConfigValType constexpr
Returns ConfigValType::MagnumVec4 type enum for specified type.
template<>
auto configValTypeFor<Mn::Color4>() -> ConfigValType constexpr
Returns ConfigValType::MagnumVec4 type enum for specified type.
template<>
auto configValTypeFor<Mn::Matrix3>() -> ConfigValType constexpr
Returns ConfigValType::MagnumMat3 type enum for specified type.
template<>
auto configValTypeFor<Mn::Matrix4>() -> ConfigValType constexpr
Returns ConfigValType::MagnumMat4 type enum for specified type.
template<>
auto configValTypeFor<Mn::Quaternion>() -> ConfigValType constexpr
Returns ConfigValType::MagnumQuat type enum for specified type.
auto operator<<(Mn::Debug& debug, const ConfigValType& value) -> Mn::Debug&
Stream operator to support display of ConfigValType enum tags.
auto operator<<(Mn::Debug& debug, const ConfigValue& value) -> Mn::Debug&
provide debug stream support for ConfigValue
auto operator<<(Mn::Debug& debug, const Configuration& value) -> Mn::Debug&
provide debug stream support for a Configuration

Variables

int CONFIG_VAL_SIZE constexpr

Enum documentation

enum class esp::core::config::ConfigValType

This enum lists every type of value that can be currently stored directly in an esp::core::config::Configuration. All supported types should have entries in this enum class. All pointer-backed types (i.e. data larger than ConfigValue::_data array sizee) should have their enums placed after _storedAsAPointer tag. All non-trivial types should have their enums placed below _nonTrivialTypes tag. Any small, trivially copyable types should be placed before _storedAsAPointer tag.

Enumerators
Unknown

Unknown type.

Boolean

boolean type

Integer

integer type

MagnumRad

Magnum::Rad angle type.

MagnumDeg

Magnum::Deg angle type.

Double

double type

MagnumVec2

Magnum::Vector2 type.

MagnumVec2i

Magnum::Vector2i type.

_storedAsAPointer

MagnumVec3

Magnum::Vector3 type. All types of size greater than _data size must be placed after this marker, either before or after String, depending on if they are trivially copyable or not.

MagnumVec4

Magnum::Vector4 type.

MagnumQuat

Magnum::Quaternion type.

MagnumMat3

Magnum::Matrix3 (3x3) type.

MagnumMat4

Magnum::Matrix4 (4x4) type.

_nonTrivialTypes

String

All enum values of nontrivial types must be added after String .

enum esp::core::config::ConfigValStatus: uint64_t

This enum lists the bit flags describing the various states ConfigValue can be in or characteristics they may have. These mask the higher order DWORD of _typeAndFlags, and so begin on bit 32 of 0-63.

Enumerators
isDefault

Whether or not the ConfigValue was set with a default/initializing value. This flag is used, for example, to govern whether a value should be written to file or not - if the value was set only with a program-governed default value, it should not be written to file.

isHidden

Specifies that this ConfigValue is hidden and used as an internally tracked/managed variable, not part of the user-accessible metadata itself. These variables should never be written to file or displayed except for debugging purposes.

isTranslated

Specifies that this ConfigValue is translated from a string value to some other value/representation, such as an enum, intended to provide constrained values and string representations. These types of values are stored as strings and translated (i.e. cast) to the appropriate Enums on access by the extending class for the Configuration. They are saved to file as a string that is mapped from the enum value.

NOTE : Any ConfigValues specified as isTranslated need to have their Json read handled by the consuming class, as they may not be properly read from or written to file otherwise.

reqsFuzzyComparison

This ConfigValue requires manual fuzzy comparison (i.e. floating point scalar type) using the Magnum::Math::equal method. Magnum types already perform fuzzy comparison.

Function documentation

void esp::core::config::initConfigBindings(pybind11::module& m)

Specify bindings for esp::core::config::Configuration.

std::string esp::core::config::getNameForStoredType(const ConfigValType& value)

Retrieve a string description of the passed ConfigValType enum value.

bool esp::core::config::isConfigValTypePointerBased(ConfigValType type) constexpr

Quick check to see if type is stored as a pointer in the data or not (i.e. the type is trivially copyable or not)

bool esp::core::config::isConfigValTypeNonTrivial(ConfigValType type) constexpr

Quick check to see if type is trivially copyable or not.

template<typename T>
bool esp::core::config::useFuzzyComparisonFor() constexpr

Function template to return whether the value requires fuzzy comparison or not.

template<>
bool esp::core::config::useFuzzyComparisonFor<double>() constexpr

Specify that ConfigValType::Double scalar floating point values require fuzzy comparison.

template<typename T>
ConfigValType esp::core::config::configValTypeFor() constexpr

Function template to return type enum for specified type. All supported types should have a specialization of this function handling their type to ConfigValType enum tags mapping.

template<>
ConfigValType esp::core::config::configValTypeFor<bool>() constexpr

Returns ConfigValType::Boolean type enum for specified type.

template<>
ConfigValType esp::core::config::configValTypeFor<int>() constexpr

Returns ConfigValType::Integer type enum for specified type.

template<>
ConfigValType esp::core::config::configValTypeFor<Mn::Rad>() constexpr

Returns ConfigValType::MagnumRad type enum for specified type.

template<>
ConfigValType esp::core::config::configValTypeFor<Mn::Deg>() constexpr

Returns ConfigValType::MagnumDeg type enum for specified type.

template<>
ConfigValType esp::core::config::configValTypeFor<double>() constexpr

Returns ConfigValType::Double type enum for specified type.

template<>
ConfigValType esp::core::config::configValTypeFor<Mn::Vector2>() constexpr

Returns ConfigValType::MagnumVec2 type enum for specified type.

template<>
ConfigValType esp::core::config::configValTypeFor<Mn::Vector2i>() constexpr

Returns ConfigValType::MagnumVec2i type enum for specified type.

template<>
ConfigValType esp::core::config::configValTypeFor<Mn::Vector3>() constexpr

Returns ConfigValType::MagnumVec3 type enum for specified type.

template<>
ConfigValType esp::core::config::configValTypeFor<Mn::Color3>() constexpr

Returns ConfigValType::MagnumVec3 type enum for specified type.

template<>
ConfigValType esp::core::config::configValTypeFor<Mn::Vector4>() constexpr

Returns ConfigValType::MagnumVec4 type enum for specified type.

template<>
ConfigValType esp::core::config::configValTypeFor<Mn::Color4>() constexpr

Returns ConfigValType::MagnumVec4 type enum for specified type.

template<>
ConfigValType esp::core::config::configValTypeFor<Mn::Matrix3>() constexpr

Returns ConfigValType::MagnumMat3 type enum for specified type.

template<>
ConfigValType esp::core::config::configValTypeFor<Mn::Matrix4>() constexpr

Returns ConfigValType::MagnumMat4 type enum for specified type.

template<>
ConfigValType esp::core::config::configValTypeFor<Mn::Quaternion>() constexpr

Returns ConfigValType::MagnumQuat type enum for specified type.

Mn::Debug& esp::core::config::operator<<(Mn::Debug& debug, const ConfigValType& value)

Stream operator to support display of ConfigValType enum tags.

Mn::Debug& esp::core::config::operator<<(Mn::Debug& debug, const ConfigValue& value)

provide debug stream support for ConfigValue

Mn::Debug& esp::core::config::operator<<(Mn::Debug& debug, const Configuration& value)

provide debug stream support for a Configuration

Variable documentation

int esp::core::config::CONFIG_VAL_SIZE constexpr