![]() |
LogIt++
|
Structure for storing values of various types, including enumerations. More...
#include <VariableValue.hpp>
Public Types | |
enum class | ValueType { INT8_VAL , UINT8_VAL , INT16_VAL , UINT16_VAL , INT32_VAL , UINT32_VAL , INT64_VAL , UINT64_VAL , BOOL_VAL , CHAR_VAL , FLOAT_VAL , DOUBLE_VAL , LONG_DOUBLE_VAL , DURATION_VAL , TIME_POINT_VAL , STRING_VAL , EXCEPTION_VAL , ERROR_CODE_VAL , ENUM_VAL , PATH_VAL , POINTER_VAL , SMART_POINTER_VAL , VARIANT_VAL , OPTIONAL_VAL , UNKNOWN_VAL } |
Enumeration of possible value types for VariableValue. More... | |
Public Member Functions | |
template<typename T> | |
VariableValue (const std::string &name, T value, typename std::enable_if< std::is_same< T, bool >::value >::type *=nullptr) | |
template<typename T> | |
VariableValue (const std::string &name, T value, typename std::enable_if< std::is_same< T, char >::value >::type *=nullptr) | |
VariableValue (const std::string &name, const std::string &value) | |
VariableValue (const std::string &name, const char *value) | |
template<typename T> | |
VariableValue (const std::string &name, const T &value, typename std::enable_if< std::is_base_of< std::exception, T >::value >::type *=nullptr) | |
VariableValue (const std::string &name, const std::error_code &ec) | |
template<typename T> | |
VariableValue (const std::string &name, T value, typename std::enable_if< std::is_floating_point< T >::value >::type *=nullptr) | |
template<typename T> | |
VariableValue (const std::string &name, T value, typename std::enable_if< std::is_integral< T >::value >::type *=nullptr) | |
template<typename EnumType> | |
VariableValue (const std::string &name, EnumType value, typename std::enable_if< std::is_enum< EnumType >::value >::type *=0) | |
Constructor for enumerations. | |
template<typename Rep, typename Period> | |
VariableValue (const std::string &name, const std::chrono::duration< Rep, Period > &duration) | |
template<typename Clock, typename Duration> | |
VariableValue (const std::string &name, const std::chrono::time_point< Clock, Duration > &time_point) | |
VariableValue (const std::string &name, const std::filesystem::path &path) | |
template<typename... Ts> | |
VariableValue (const std::string &name, const std::variant< Ts... > &variant) | |
template<typename T> | |
VariableValue (const std::string &name, const std::optional< T > &optional) | |
VariableValue (const std::string &name, void *ptr) | |
template<typename T> | |
VariableValue (const std::string &name, const std::shared_ptr< T > &ptr) | |
template<typename T> | |
VariableValue (const std::string &name, const std::unique_ptr< T > &ptr) | |
VariableValue (const VariableValue &other) | |
Copy constructor. | |
VariableValue & | operator= (const VariableValue &other) |
Assignment operator. | |
~VariableValue ()=default | |
Destructor. | |
std::string | to_string () const |
Method to get the value as a string. | |
std::string | to_string (const char *fmt) const |
Method to get the value as a formatted string. | |
Public Attributes | ||
std::string | name | |
Variable name. | ||
bool | is_literal | |
Flag indicating if the variable is a literal. | ||
enum logit::VariableValue::ValueType | type | |
Specifies the type of the stored value in the VariableValue structure. | ||
union { | ||
int8_t int8_value | ||
uint8_t uint8_value | ||
int16_t int16_value | ||
uint16_t uint16_value | ||
int32_t int32_value | ||
uint32_t uint32_value | ||
int64_t int64_value | ||
uint64_t uint64_value | ||
bool bool_value | ||
char char_value | ||
float float_value | ||
double double_value | ||
long double long_double_value | ||
} | pod_value | |
Union to store POD types. | ||
std::string | string_value | |
Variable to store string, exception messages, and enums. | ||
std::error_code | error_code_value | |
Variable to store std::error_code. | ||
Static Private Member Functions | |
static bool | is_valid_literal_name (const std::string &name) |
Helper function to check if a name is a valid literal. | |
static bool | is_pod_type (ValueType type) |
Helper function to determine if a ValueType represents a POD type. | |
template<typename Period> | |
static std::string | duration_units () |
Helper function to get the unit of the duration. | |
Structure for storing values of various types, including enumerations.
Definition at line 38 of file VariableValue.hpp.
|
strong |
Enumeration of possible value types for VariableValue.
Definition at line 44 of file VariableValue.hpp.
|
inline |
Definition at line 93 of file VariableValue.hpp.
|
inline |
Definition at line 100 of file VariableValue.hpp.
|
inlineexplicit |
Definition at line 106 of file VariableValue.hpp.
|
inlineexplicit |
Definition at line 110 of file VariableValue.hpp.
|
inline |
Definition at line 114 of file VariableValue.hpp.
|
inlineexplicit |
Definition at line 119 of file VariableValue.hpp.
|
inline |
Definition at line 124 of file VariableValue.hpp.
|
inline |
Definition at line 140 of file VariableValue.hpp.
|
inline |
Constructor for enumerations.
EnumType | The enumeration type. |
name | The variable name. |
value | The enumeration value. |
Definition at line 179 of file VariableValue.hpp.
|
inline |
Definition at line 186 of file VariableValue.hpp.
|
inline |
Definition at line 192 of file VariableValue.hpp.
|
inlineexplicit |
Definition at line 200 of file VariableValue.hpp.
|
inlineexplicit |
Definition at line 205 of file VariableValue.hpp.
|
inlineexplicit |
Definition at line 221 of file VariableValue.hpp.
|
inlineexplicit |
Definition at line 240 of file VariableValue.hpp.
|
inlineexplicit |
Definition at line 248 of file VariableValue.hpp.
|
inlineexplicit |
Definition at line 257 of file VariableValue.hpp.
|
inline |
Copy constructor.
Definition at line 266 of file VariableValue.hpp.
|
default |
Destructor.
|
inlinestaticprivate |
Helper function to get the unit of the duration.
Period | The period type of the duration. |
Definition at line 403 of file VariableValue.hpp.
|
inlinestaticprivate |
Helper function to determine if a ValueType represents a POD type.
type | The ValueType to check. |
Definition at line 378 of file VariableValue.hpp.
|
inlinestaticprivate |
Helper function to check if a name is a valid literal.
name | The name to check. |
Definition at line 370 of file VariableValue.hpp.
|
inline |
Assignment operator.
Definition at line 276 of file VariableValue.hpp.
|
inline |
Method to get the value as a string.
Definition at line 297 of file VariableValue.hpp.
|
inline |
Method to get the value as a formatted string.
fmt | The format string. |
Definition at line 333 of file VariableValue.hpp.
bool logit::VariableValue::bool_value |
Definition at line 81 of file VariableValue.hpp.
char logit::VariableValue::char_value |
Definition at line 82 of file VariableValue.hpp.
double logit::VariableValue::double_value |
Definition at line 84 of file VariableValue.hpp.
std::error_code logit::VariableValue::error_code_value |
Variable to store std::error_code.
Definition at line 89 of file VariableValue.hpp.
float logit::VariableValue::float_value |
Definition at line 83 of file VariableValue.hpp.
int16_t logit::VariableValue::int16_value |
Definition at line 75 of file VariableValue.hpp.
int32_t logit::VariableValue::int32_value |
Definition at line 77 of file VariableValue.hpp.
int64_t logit::VariableValue::int64_value |
Definition at line 79 of file VariableValue.hpp.
int8_t logit::VariableValue::int8_value |
Definition at line 73 of file VariableValue.hpp.
bool logit::VariableValue::is_literal |
Flag indicating if the variable is a literal.
Definition at line 40 of file VariableValue.hpp.
long double logit::VariableValue::long_double_value |
Definition at line 85 of file VariableValue.hpp.
std::string logit::VariableValue::name |
Variable name.
Definition at line 39 of file VariableValue.hpp.
union { ... } logit::VariableValue::pod_value |
Union to store POD types.
std::string logit::VariableValue::string_value |
Variable to store string, exception messages, and enums.
Definition at line 88 of file VariableValue.hpp.
enum logit::VariableValue::ValueType logit::VariableValue::type |
Specifies the type of the stored value in the VariableValue structure.
uint16_t logit::VariableValue::uint16_value |
Definition at line 76 of file VariableValue.hpp.
uint32_t logit::VariableValue::uint32_value |
Definition at line 78 of file VariableValue.hpp.
uint64_t logit::VariableValue::uint64_value |
Definition at line 80 of file VariableValue.hpp.
uint8_t logit::VariableValue::uint8_value |
Definition at line 74 of file VariableValue.hpp.