default implementation of simple serialize/deserialize
This commit is contained in:
parent
9a2e68b37e
commit
42a1d6cccd
@ -90,6 +90,32 @@ class SerializeIF {
|
|||||||
*/
|
*/
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
Endianness streamEndianness) = 0;
|
Endianness streamEndianness) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method which can be used if serialization should be performed without any additional
|
||||||
|
* pointer arithmetic on a passed buffer pointer
|
||||||
|
* @param buffer
|
||||||
|
* @param maxSize
|
||||||
|
* @param streamEndianness
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
virtual ReturnValue_t serialize(uint8_t* buffer, size_t maxSize, Endianness streamEndianness) {
|
||||||
|
size_t tmpSize = 0;
|
||||||
|
return serialize(&buffer, &tmpSize, maxSize, streamEndianness);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper methods which can be used if deserialization should be performed without any additional
|
||||||
|
* pointer arithmetic on a passed buffer pointer
|
||||||
|
* @param buffer
|
||||||
|
* @param maxSize
|
||||||
|
* @param streamEndianness
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
virtual ReturnValue_t deSerialize(const uint8_t* buffer, size_t maxSize,
|
||||||
|
Endianness streamEndianness) {
|
||||||
|
return deSerialize(&buffer, &maxSize, streamEndianness);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_SERIALIZE_SERIALIZEIF_H_ */
|
#endif /* FSFW_SERIALIZE_SERIALIZEIF_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user