|
Container System 0.1.0
High-performance C++20 type-safe container framework with SIMD-accelerated serialization
|
Enhanced type-safe value with perfect legacy compatibility. More...
#include <value.h>

Public Member Functions | |
| value () | |
| Default constructor - creates null value. | |
| value (std::string_view name) | |
| Construct with name (null value) | |
| template<typename T > | |
| value (std::string_view name, T &&value) | |
| Construct with name and typed value. | |
| value (std::string_view name, value_types type, const std::vector< uint8_t > &raw_data) | |
| Construct from value_types and raw data (legacy compatibility) | |
| value (const value &other) | |
| Copy constructor (thread-safe) | |
| value (value &&other) noexcept | |
| Move constructor. | |
| value & | operator= (const value &other) |
| Copy assignment (thread-safe) | |
| value & | operator= (value &&other) noexcept |
| Move assignment. | |
| std::string_view | name () const noexcept |
| Get the name of this value (lock-free, immutable) | |
| value_types | type () const |
| Get the value_types enum (NOT variant::index()!) | |
| size_t | variant_index () const |
| Get variant index (for internal use only) | |
| bool | is_null () const |
| Check if null value. | |
| template<concepts::ValueVariantType T> | |
| std::optional< T > | get () const |
| Type-safe getter with optional return. | |
| template<concepts::ValueVariantType T> | |
| void | set (T &&value) |
| Type-safe setter. | |
| template<concepts::ValueVisitor Visitor> | |
| auto | visit (Visitor &&vis) const |
| Apply visitor to contained value (const) | |
| template<concepts::ValueVisitor Visitor> | |
| auto | visit_mut (Visitor &&vis) |
| Apply visitor to contained value (mutable) | |
| std::string | to_string () const |
| Convert to string representation. | |
| std::string | to_json () const |
| Convert to JSON representation. | |
| std::vector< uint8_t > | serialize () const |
| Serialize to binary format (legacy compatible) | |
| size_t | read_count () const |
| Get read/write statistics. | |
| size_t | write_count () const |
| bool | operator== (const value &other) const |
| Comparison operators (thread-safe) | |
| bool | operator!= (const value &other) const |
| bool | operator< (const value &other) const |
Static Public Member Functions | |
| static std::optional< value > | deserialize (const std::vector< uint8_t > &data) |
| Deserialize from binary format (legacy compatible) | |
Private Member Functions | |
| void | serialize_data (std::vector< uint8_t > &result) const |
| Serialize data portion based on type. | |
Static Private Member Functions | |
| static bool | deserialize_data (value &result, value_types type, const std::vector< uint8_t > &data, size_t &offset) |
| Deserialize data portion based on type. | |
Private Attributes | |
| const std::string | name_ |
| ValueVariant | data_ |
| std::shared_mutex | mutex_ |
| std::atomic< size_t > | read_count_ {0} |
| std::atomic< size_t > | write_count_ {0} |
Enhanced type-safe value with perfect legacy compatibility.
Key improvements over variant_value:
|
inline |
Default constructor - creates null value.
Definition at line 134 of file value.h.
Referenced by deserialize_data(), to_json(), and to_string().

|
inlineexplicit |
Construct with name (null value)
Definition at line 139 of file value.h.
|
inline |
Construct with name and typed value.
Definition at line 146 of file value.h.
| kcenon::container::value::value | ( | std::string_view | name, |
| value_types | type, | ||
| const std::vector< uint8_t > & | raw_data ) |
Construct from value_types and raw data (legacy compatibility)
Definition at line 87 of file value.cpp.
References data_, deserialize_data(), and type().

| kcenon::container::value::value | ( | const value & | other | ) |
|
noexcept |
Move constructor.
Definition at line 107 of file value.cpp.
|
static |
Deserialize from binary format (legacy compatible)
Supports both:
Definition at line 555 of file value.cpp.
References deserialize_data(), name(), and type().
Referenced by kcenon::container::clone_with_name(), kcenon::container::thread_safe_container::deserialize(), and deserialize_data().


|
staticprivate |
Deserialize data portion based on type.
Definition at line 359 of file value.cpp.
References data_, kcenon::container::thread_safe_container::deserialize(), deserialize(), type(), value(), and kcenon::container::array_variant::values.
Referenced by deserialize(), and value().


|
inline |
|
inline |
|
inlinenoexcept |
Get the name of this value (lock-free, immutable)
Definition at line 177 of file value.h.
References name_.
Referenced by deserialize(), kcenon::container::thread_safe_container::set_variant(), and to_json().

|
inline |
| bool kcenon::container::value::operator< | ( | const value & | other | ) | const |
Copy assignment (thread-safe)
Definition at line 118 of file value.cpp.
References data_, mutex_, and write_count_.
Move assignment.
Definition at line 128 of file value.cpp.
| bool kcenon::container::value::operator== | ( | const value & | other | ) | const |
|
inline |
| std::vector< uint8_t > kcenon::container::value::serialize | ( | ) | const |
Serialize to binary format (legacy compatible)
Wire format: [name_len:4][name:UTF-8][type:1][data:variable]
Type byte matches value_types enum EXACTLY (0-15)
Definition at line 339 of file value.cpp.
References name_, serialize_data(), and type().
Referenced by kcenon::container::clone_with_name(), kcenon::container::thread_safe_container::serialize(), and serialize_data().


|
private |
Serialize data portion based on type.
Definition at line 259 of file value.cpp.
References kcenon::container::detail::circular_ref_guard::is_circular(), serialize(), and visit().
Referenced by serialize().


|
inline |
Type-safe setter.
| T | The type to store (must be valid variant type) |
Definition at line 226 of file value.h.
References data_, mutex_, and write_count_.
| std::string kcenon::container::value::to_json | ( | ) | const |
Convert to JSON representation.
Definition at line 186 of file value.cpp.
References name(), to_json(), type(), value(), and visit().
Referenced by kcenon::container::thread_safe_container::to_json(), to_json(), and to_string().


| std::string kcenon::container::value::to_string | ( | ) | const |
Convert to string representation.
Definition at line 146 of file value.cpp.
References to_json(), to_string(), value(), and visit().
Referenced by to_string().


| value_types kcenon::container::value::type | ( | ) | const |
Get the value_types enum (NOT variant::index()!)
IMPORTANT: This returns the logical type, which matches:
On platforms where llong == int64_t, llong_value returns as long_value.
Definition at line 138 of file value.cpp.
Referenced by deserialize(), deserialize_data(), kcenon::container::same_type(), serialize(), to_json(), kcenon::container::type_name(), and value().

|
inline |
|
inline |
Apply visitor to contained value (const)
| Visitor | The visitor callable type |
Definition at line 237 of file value.h.
References data_, mutex_, and read_count_.
Referenced by serialize_data(), to_json(), and to_string().

|
inline |
Apply visitor to contained value (mutable)
| Visitor | The visitor callable type |
Definition at line 248 of file value.h.
References data_, mutex_, and write_count_.
|
inline |
|
private |
Definition at line 313 of file value.h.
Referenced by deserialize_data(), get(), is_null(), operator<(), operator=(), operator==(), set(), type(), value(), value(), variant_index(), visit(), and visit_mut().
|
mutableprivate |
Definition at line 314 of file value.h.
Referenced by get(), is_null(), operator<(), operator=(), operator==(), set(), type(), value(), variant_index(), visit(), and visit_mut().
|
private |
Definition at line 312 of file value.h.
Referenced by name(), operator<(), operator==(), and serialize().
|
mutableprivate |
|
mutableprivate |
Definition at line 316 of file value.h.
Referenced by operator=(), set(), visit_mut(), and write_count().