Merge branch 'mueller/expand-serialize-if' into mueller/refactor-tmtc-stack

This commit is contained in:
Robin Müller 2022-07-23 10:05:14 +02:00
commit c9d37e8d62

View File

@ -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_ */