default implementation of simple serialize/deserialize

This commit is contained in:
Robin Müller 2022-07-23 10:03:42 +02:00
parent 9a2e68b37e
commit 42a1d6cccd
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -90,6 +90,32 @@ class SerializeIF {
*/
virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
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_ */