Container System 0.1.0
High-performance C++20 type-safe container framework with SIMD-accelerated serialization
Loading...
Searching...
No Matches
kcenon::container Namespace Reference

Namespaces

namespace  async
 
namespace  detail
 Compile-time verification of type alignment.
 
namespace  factory
 Modern factory namespace for creating value instances.
 
namespace  integration
 
namespace  internal
 
namespace  simd
 

Classes

struct  array_variant
 Recursive array type for variant. More...
 
class  auto_refresh_reader
 Auto-refreshing lock-free reader. More...
 
class  epoch_guard
 RAII guard for epoch critical section. More...
 
class  epoch_manager
 Epoch-based memory reclamation for lock-free data structures. More...
 
struct  is_variant_type_v2
 Type traits for variant types. More...
 
struct  is_variant_type_v2< array_variant >
 
struct  is_variant_type_v2< bool >
 
struct  is_variant_type_v2< double >
 
struct  is_variant_type_v2< float >
 
struct  is_variant_type_v2< int16_t >
 
struct  is_variant_type_v2< int32_t >
 
struct  is_variant_type_v2< int64_t >
 
struct  is_variant_type_v2< std::monostate >
 
struct  is_variant_type_v2< std::shared_ptr< thread_safe_container > >
 
struct  is_variant_type_v2< std::string >
 
struct  is_variant_type_v2< std::vector< uint8_t > >
 
struct  is_variant_type_v2< uint16_t >
 
struct  is_variant_type_v2< uint32_t >
 
struct  is_variant_type_v2< uint64_t >
 
class  lockfree_container_reader
 True lock-free reader using RCU (Read-Copy-Update) pattern. More...
 
class  rcu_value
 Lock-free value wrapper using Read-Copy-Update (RCU) pattern. More...
 
class  snapshot_reader
 Snapshot-based reader for frequently accessed data. More...
 
class  thread_safe_container
 Thread-safe container with lock optimization. More...
 
class  value
 Enhanced type-safe value with perfect legacy compatibility. More...
 
struct  value_index_entry
 Value index entry for lazy parsing. More...
 
class  value_view
 Zero-copy value view for efficient read access. More...
 

Typedefs

using lockfree_reader = snapshot_reader
 
using ValueVariant
 Type-aligned variant matching value_types enum EXACTLY.
 

Functions

std::ostream & operator<< (std::ostream &out, value_container &other)
 
std::ostream & operator<< (std::ostream &out, std::shared_ptr< value_container > other)
 
std::string & operator<< (std::string &out, value_container &other)
 
std::string & operator<< (std::string &out, std::shared_ptr< value_container > other)
 
value_types convert_value_type (const std::string &target)
 
std::string convert_value_type (const value_types &target)
 
value make_value_from_raw (std::string_view name, value_types type, const std::vector< uint8_t > &raw_data)
 Create a value from value_types enum and raw data.
 
value clone_with_name (const value &original, std::string_view new_name)
 Create a copy of a value with a new name.
 
bool same_type (const value &a, const value &b)
 Check if two values have the same type.
 
std::string_view type_name (const value &value)
 Get human-readable type name.
 

Variables

constexpr int TARGET_ID = 1
 
constexpr int TARGET_SUB_ID = 2
 
constexpr int SOURCE_ID = 3
 
constexpr int SOURCE_SUB_ID = 4
 
constexpr int MESSAGE_TYPE = 5
 
constexpr int MESSAGE_VERSION = 6
 
template<typename T >
constexpr bool is_variant_type_v2_v = is_variant_type_v2<T>::value
 

Typedef Documentation

◆ lockfree_reader

◆ ValueVariant

Initial value:
std::variant<
std::monostate,
bool,
int16_t,
uint16_t,
int32_t,
uint32_t,
long,
unsigned long,
long long,
unsigned long long,
float,
double,
std::string,
std::vector<uint8_t>,
std::shared_ptr<thread_safe_container>,
array_variant
>

Type-aligned variant matching value_types enum EXACTLY.

CRITICAL: The order of types MUST match value_types enum (0-15) This ensures variant::index() == static_cast<size_t>(value_types)

Index mapping verification:

  • variant.index() 0 == value_types::null_value (0)
  • variant.index() 1 == value_types::bool_value (1)
  • variant.index() 2 == value_types::short_value (2) ...
  • variant.index() 15 == value_types::array_value (15)

Definition at line 72 of file value.h.

Function Documentation

◆ clone_with_name()

value kcenon::container::clone_with_name ( const value & original,
std::string_view new_name )
inline

Create a copy of a value with a new name.

Definition at line 166 of file variant_value_factory.h.

167 {
168 // Serialize and deserialize to create a deep copy, then change name
169 auto serialized = original.serialize();
170 auto cloned = value::deserialize(serialized);
171 if (!cloned) {
172 throw std::runtime_error("Failed to clone value");
173 }
174
175 // Create new value with same data but different name
176 return value(new_name, cloned->type(), serialized);
177 }
std::vector< uint8_t > serialize() const
Serialize to binary format (legacy compatible)
Definition value.cpp:339

References kcenon::container::value::deserialize(), and kcenon::container::value::serialize().

Here is the call graph for this function:

◆ convert_value_type() [1/2]

value_types kcenon::container::convert_value_type ( const std::string & target)

Definition at line 9 of file value_types.cpp.

10 {
11 // Use the constexpr function for better performance
12 return get_type_from_string(target);
13 }

◆ convert_value_type() [2/2]

std::string kcenon::container::convert_value_type ( const value_types & target)

Definition at line 15 of file value_types.cpp.

16 {
17 // Use the constexpr function and convert to std::string
18 return std::string(get_string_from_type(target));
19 }

◆ make_value_from_raw()

value kcenon::container::make_value_from_raw ( std::string_view name,
value_types type,
const std::vector< uint8_t > & raw_data )
inline

Create a value from value_types enum and raw data.

This is the low-level factory that mirrors the legacy system's constructor. Prefer value constructors or factory::make<T>() when the type is known at compile time.

Parameters
nameValue name
typeThe value_types enum
raw_dataBinary data for the value
Returns
value containing the parsed value
Exceptions
std::runtime_errorif type is unsupported or data is invalid

Definition at line 153 of file variant_value_factory.h.

155 {
156 return value(name, type, raw_data);
157 }
Enhanced type-safe value with perfect legacy compatibility.
Definition value.h:129

◆ operator<<() [1/4]

std::ostream & kcenon::container::operator<< ( std::ostream & out,
std::shared_ptr< value_container > other )

Definition at line 1848 of file container.cpp.

1850 {
1851 if (other)
1852 {
1853 binary_serializer serializer;
1854 out << serializer.serialize_to_string(*other);
1855 }
1856 return out;
1857 }

References operator<<().

Here is the call graph for this function:

◆ operator<<() [2/4]

std::ostream & kcenon::container::operator<< ( std::ostream & out,
value_container & other )

Definition at line 1841 of file container.cpp.

1842 {
1843 binary_serializer serializer;
1844 out << serializer.serialize_to_string(other);
1845 return out;
1846 }

References operator<<().

Referenced by operator<<(), operator<<(), operator<<(), and operator<<().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator<<() [3/4]

std::string & kcenon::container::operator<< ( std::string & out,
std::shared_ptr< value_container > other )

Definition at line 1866 of file container.cpp.

1868 {
1869 if (other)
1870 {
1871 binary_serializer serializer;
1872 out = serializer.serialize_to_string(*other);
1873 }
1874 else
1875 out.clear();
1876 return out;
1877 }

References operator<<().

Here is the call graph for this function:

◆ operator<<() [4/4]

std::string & kcenon::container::operator<< ( std::string & out,
value_container & other )

Definition at line 1859 of file container.cpp.

1860 {
1861 binary_serializer serializer;
1862 out = serializer.serialize_to_string(other);
1863 return out;
1864 }

References operator<<().

Here is the call graph for this function:

◆ same_type()

bool kcenon::container::same_type ( const value & a,
const value & b )
inline

Check if two values have the same type.

Definition at line 182 of file variant_value_factory.h.

182 {
183 return a.type() == b.type();
184 }
value_types type() const
Get the value_types enum (NOT variant::index()!)
Definition value.cpp:138

References kcenon::container::value::type().

Here is the call graph for this function:

◆ type_name()

std::string_view kcenon::container::type_name ( const value & value)
inline

Get human-readable type name.

Definition at line 189 of file variant_value_factory.h.

189 {
190 switch (value.type()) {
191 case value_types::null_value: return "null";
192 case value_types::bool_value: return "bool";
193 case value_types::short_value: return "short";
194 case value_types::ushort_value: return "ushort";
195 case value_types::int_value: return "int";
196 case value_types::uint_value: return "uint";
197 case value_types::long_value: return "long";
198 case value_types::ulong_value: return "ulong";
199 case value_types::llong_value: return "llong";
200 case value_types::ullong_value: return "ullong";
201 case value_types::float_value: return "float";
202 case value_types::double_value: return "double";
203 case value_types::bytes_value: return "bytes";
204 case value_types::string_value: return "string";
205 case value_types::container_value: return "container";
206 case value_types::array_value: return "array";
207 default: return "unknown";
208 }
209 }

References kcenon::container::value::type().

Here is the call graph for this function:

Variable Documentation

◆ is_variant_type_v2_v

template<typename T >
bool kcenon::container::is_variant_type_v2_v = is_variant_type_v2<T>::value
inlineconstexpr

Definition at line 342 of file value.h.

◆ MESSAGE_TYPE

int kcenon::container::MESSAGE_TYPE = 5
inlineconstexpr

Definition at line 36 of file container.cpp.

◆ MESSAGE_VERSION

int kcenon::container::MESSAGE_VERSION = 6
inlineconstexpr

Definition at line 37 of file container.cpp.

◆ SOURCE_ID

int kcenon::container::SOURCE_ID = 3
inlineconstexpr

Definition at line 34 of file container.cpp.

◆ SOURCE_SUB_ID

int kcenon::container::SOURCE_SUB_ID = 4
inlineconstexpr

Definition at line 35 of file container.cpp.

◆ TARGET_ID

int kcenon::container::TARGET_ID = 1
inlineconstexpr

Definition at line 32 of file container.cpp.

◆ TARGET_SUB_ID

int kcenon::container::TARGET_SUB_ID = 2
inlineconstexpr

Definition at line 33 of file container.cpp.