esp/core/Configuration.h file

Namespaces

namespace esp
Root namespace.
namespace esp::core
Core Habitat functionality.
namespace esp::core::config
Configuration functionality.

Classes

class esp::core::config::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.
class esp::core::config::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.

Enums

enum class ConfigValType { Unknown = ID_UNDEFINED, Boolean, Integer, MagnumRad, Double, MagnumVec2, _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

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<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::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.
template<>
auto configValTypeFor<Mn::Rad>() -> ConfigValType constexpr
Returns ConfigValType::MagnumRad 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