44 template <
typename Map>
58 size_t size = map.size();
59 stream.
append(
reinterpret_cast<const char*
>(&size),
sizeof(size));
61 for (
const auto& pair : map)
82 uint8_t* localIt =
reinterpret_cast<uint8_t*
>(it);
83 std::memcpy(&size, localIt,
sizeof(size));
84 localIt +=
sizeof(size);
87 for (
size_t i = 0; i < size; ++i)
89 typename Map::key_type key;
90 typename Map::mapped_type value;
93 map.insert({key, value});
106 template <
typename Key,
typename Value>
123 template <
typename Key,
typename Value>
124 struct traits<const std::map<Key, Value>>
Manages memory a byte buffer, offering dynamic appending. This class is designed for scenarios where ...
Definition buffer.hpp:50
virtual void append(const void *buffer_to_append, const std::size_t length_of_buffer)
append the given buffer to the end of the current buffer. If there is no current buffer yet,...
Definition buffer.hpp:96
Implements traits-based serialization for complex data types, including standard containers and custo...
Definition direct.hpp:38
void * serialized_object
Represents a serialized value in memory.
Definition traits.hpp:42
Provides serialization and deserialization logic for standard map-like containers.
Definition map.hpp:46
static void deserialize(serialized_object &it, Map &map)
Deserializes map data from the buffer into a Map instance, replacing its current contents.
Definition map.hpp:77
static void serialize(const Map &map, container::buffer &stream)
Serializes all key-value pairs of the map into a binary format appended to stream.
Definition map.hpp:56
static void serialize(const std::map< Key, Value > &map, container::buffer &stream)
Definition map.hpp:126
static void deserialize(serialized_object &it, std::map< Key, Value > &map)
Definition map.hpp:114
static void serialize(const std::map< Key, Value > &map, container::buffer &stream)
Definition map.hpp:109
Defines the traits required for serializing and deserializing objects of type T.
Definition traits.hpp:52
static void serialize(const T &val, container::buffer &stream)
Required to serialize an object of type T into a shared_buffer stream.
Definition traits.hpp:63
static void deserialize(serialized_object &it, T &val)
Required to deserialize an object of type T from a serialized memory block, incrementing the iterator...
Definition traits.hpp:77