The SerializedObject contains and manages the payload of your serializations.
More...
#include <bas.hpp>
The SerializedObject contains and manages the payload of your serializations.
This class is the result of a Serializable::serialization.
- Examples
- intrication.cpp, pushpoparray.cpp, pushpopsimple.cpp, and serialization.cpp.
◆ SerializedObject() [1/3]
bas::SerializedObject::SerializedObject |
( |
| ) |
|
|
inline |
◆ SerializedObject() [2/3]
bas::SerializedObject::SerializedObject |
( |
const char * |
data | ) |
|
|
inline |
Construct object from payload.
This operation makes a copy of data.
- Parameters
-
◆ SerializedObject() [3/3]
◆ ~SerializedObject()
bas::SerializedObject::~SerializedObject |
( |
| ) |
|
|
default |
◆ addChecksum()
void bas::SerializedObject::addChecksum |
( |
void |
| ) |
|
|
inline |
Add Checksum at the beggining of payload.
If checksum has already been added, nothing is done.
This function should not be used by user end, except for extremely rare case.
◆ clear()
void bas::SerializedObject::clear |
( |
| ) |
|
|
inline |
◆ operator=() [1/2]
◆ operator=() [2/2]
Assign a copy of data to the payload.
This function erase the current payload.
If data is not a payload extracted with SerializedObject::payload(), behaviour might be undefined.
- Parameters
-
◆ payload()
const char* bas::SerializedObject::payload |
( |
void |
| ) |
const |
|
inline |
Returns a pointer to the payload of the object.
This function is the go-to to get the 'finished product' of your serialization.
- Returns
- Pointer to the payload of the SerializedObject
◆ popData()
template<typename T >
T bas::SerializedObject::popData |
( |
void |
| ) |
|
|
inline |
◆ popDataArray()
template<typename T >
PoppedArray<T> bas::SerializedObject::popDataArray |
( |
void |
| ) |
|
|
inline |
◆ pushData() [1/2]
template<typename T >
void bas::SerializedObject::pushData |
( |
const T & |
data | ) |
|
|
inline |
◆ pushData() [2/2]
template<typename T >
void bas::SerializedObject::pushData |
( |
const T * |
data, |
|
|
size_t |
array_size |
|
) |
| |
|
inline |
Pushes an array of data into the object payload.
To retreive data pushed by this variant of pushData(), use popDataArray<T>() where T is the type of the data pushed.
- Parameters
-
data | A pointer to the data to be pushed. |
array_size | The size of the array to be pushed. |
- See also
- popDataArray<>()
◆ removeChecksum()
void bas::SerializedObject::removeChecksum |
( |
void |
| ) |
|
|
inline |
Remove Checksum at the beggining of payload.
If checksum has already been removed, nothing is done.
This function should not be used by user end, except for extremely rare case.
◆ size()
size_t bas::SerializedObject::size |
( |
void |
| ) |
const |
|
inline |
Returns the size of the payload in Bytes.
This size include all the metadata that is added by the SerializedObject to the payload.
- Returns
- The size of the payload.
◆ vector()
std::vector<char>& bas::SerializedObject::vector |
( |
void |
| ) |
|
|
inline |
Returns a reference to the std::vector containing the payload.
User-end should use this function only in rare case, manually modifying the payload may end up in undefined behaviours.
The documentation for this class was generated from the following file: