Cbeam
Loading...
Searching...
No Matches
cbeam::serialization::map_serializer< Map > Struct Template Reference

Provides serialization and deserialization logic for standard map-like containers. More...

#include <map.hpp>

Static Public Member Functions

static void serialize (const Map &map, container::buffer &stream)
 Serializes all key-value pairs of the map into a binary format appended to stream.
 
static void deserialize (serialized_object &it, Map &map)
 Deserializes map data from the buffer into a Map instance, replacing its current contents.
 

Detailed Description

template<typename Map>
struct cbeam::serialization::map_serializer< Map >

Provides serialization and deserialization logic for standard map-like containers.

Template Parameters
MapA map-like container (e.g., std::map<Key,Value>) that supports iteration via begin() and end(), and insertion via insert(...).

Member Function Documentation

◆ deserialize()

template<typename Map>
static void cbeam::serialization::map_serializer< Map >::deserialize ( serialized_object & it,
Map & map )
inlinestatic

Deserializes map data from the buffer into a Map instance, replacing its current contents.

The number of elements is read first, then each key-value pair is deserialized and inserted into the map. The iterator it is advanced accordingly.

Parameters
itA reference to a serialized_object pointer indicating where to read from.
mapThe map object to populate with deserialized data.

◆ serialize()

template<typename Map>
static void cbeam::serialization::map_serializer< Map >::serialize ( const Map & map,
container::buffer & stream )
inlinestatic

Serializes all key-value pairs of the map into a binary format appended to stream.

The first thing written is the map size (number of elements), followed by each key and value serialized using traits.

Parameters
mapThe map to serialize.
streamA buffer to which the map data is appended.

The documentation for this struct was generated from the following file: