LMDBAL 0.6.0
LMDB (Lightning Memory-Mapped Database Manager) Abstraction Layer
|
A class handling serialization/deserialization. More...
#include <serializer.hpp>
Public Member Functions | |
Serializer () | |
Creates an empty Serializer. | |
Serializer (const T &value) | |
Creates a Serializer with some data in it. | |
~Serializer () | |
Destoys the serializer. | |
T | deserialize (const MDB_val &value) |
Deserializes value. | |
void | deserialize (const MDB_val &value, T &result) |
Deserializes value. | |
MDB_val | setData (const T &value) |
Sets the data to the seriazer. | |
MDB_val | getData () |
Returns the data if it already was serialized. | |
void | clear () |
Clears the state of serializer. | |
A class handling serialization/deserialization.
A class that is constructed in every LMDBAL::Storage to serialize or deserialize keys and values.
It serializes to and deserializes from MDB_val
K | type of the keys of the storage |
V | type of the values of the storage |
LMDBAL::Serializer< T >::Serializer | ( | const T & | value | ) |
Creates a Serializer with some data in it.
The data automatically gets serialized
[in] | value | - a value that is assigned to the serializer |
void LMDBAL::Serializer< T >::clear | ( | ) |
Clears the state of serializer.
Normally you don't need to call this function
T LMDBAL::Serializer< T >::deserialize | ( | const MDB_val & | value | ) |
Deserializes value.
This is a normal way to deseriaze value
[in] | value | - a value you want to deserialize |
void LMDBAL::Serializer< T >::deserialize | ( | const MDB_val & | value, |
T & | result ) |
Deserializes value.
This is a normal way to deseriaze value
[in] | value | - a value you want to deserialize |
[out] | result | - deserialized value |
MDB_val LMDBAL::Serializer< T >::getData | ( | ) |
Returns the data if it already was serialized.
Normally you don't need to call this function
This may be usefull if you called LMDBAL::Serilizer::setData() but lost the result
MDB_val LMDBAL::Serializer< T >::setData | ( | const T & | value | ) |
Sets the data to the seriazer.
This is a normal way to seriaze value
[in] | value | - a value you want to serialize |