Skyward boardcore
Loading...
Searching...
No Matches
Boardcore::RegistrySerializer Class Reference

Serialization and de-serialization class for the registry. It does serialize and deserialize the configuration to the specified vector. More...

#include <RegistrySerializer.h>

Public Member Functions

 RegistrySerializer (std::vector< uint8_t > &vector)
 Construct a new Registry Serializer object.
 
RegistryError serializeConfiguration (RegistryConfiguration &configuration)
 Serializes the configuration map into the uint8_t vector for serialized data.
 
RegistryError deserializeConfiguration (RegistryConfiguration &configuration)
 De-serializes the data from a serialized vector into the configuration map. In case of malformed serialized vectors, does not changes the configuration map and returns an error.
 

Detailed Description

Serialization and de-serialization class for the registry. It does serialize and deserialize the configuration to the specified vector.

Definition at line 64 of file RegistrySerializer.h.

Constructor & Destructor Documentation

◆ RegistrySerializer()

Boardcore::RegistrySerializer::RegistrySerializer ( std::vector< uint8_t > & vector)
explicit

Construct a new Registry Serializer object.

Parameters
vectorThe reference to the vector for serialization/deserialization procedures

Definition at line 30 of file RegistrySerializer.cpp.

Member Function Documentation

◆ deserializeConfiguration()

RegistryError Boardcore::RegistrySerializer::deserializeConfiguration ( RegistryConfiguration & configuration)

De-serializes the data from a serialized vector into the configuration map. In case of malformed serialized vectors, does not changes the configuration map and returns an error.

Parameters
configurationThe map in which we want to insert the entries from the serialized vector
Note
The deserialization adds/overwrites configuration entries. The already present entries, if in the deserialized data, are overriden.
Pre-existing configuration entries are not removed (but might be overwritten)
Returns
OK If the de-serialization was successful and the entries where added into the map
MALFORMED_SERIALIZED_DATA if the vector not have the appropriate length for the header, footer and configuration data
CHECKSUM_FAIL In case the saved Checksum not corresponds with the one recomputed from the serialized configuration
NO_SUCH_TYPE In case the type id not corresponds to any defined data type for the configuration
WRONG_ENDIANESS In case the endianess of the loaded data not corresponds

Definition at line 107 of file RegistrySerializer.cpp.

◆ serializeConfiguration()

RegistryError Boardcore::RegistrySerializer::serializeConfiguration ( RegistryConfiguration & configuration)

Serializes the configuration map into the uint8_t vector for serialized data.

Note
In case an error is returned no guarantees are made about the contents of the vector
The vector is resized if not of the exact size for serialization
Parameters
configurationThe configuration from which we read the current entries to be serialized
Returns
OK If the de-serialization was successful and the entries where added into the map
MALFORMED_SERIALIZED_DATA if the vector not have the appropriate length for the header, footer and configuration
CHECKSUM_FAIL In case the saved Checksum not corresponds with the one recomputed from the serialized configuration
NO_SUCH_TYPE In case the type id not corresponds to any defined data type for the configuration

Definition at line 35 of file RegistrySerializer.cpp.


The documentation for this class was generated from the following files: