diff --git a/src/fsfw/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h index 3f4fdc38..9fc5b731 100644 --- a/src/fsfw/serialize/SerializeIF.h +++ b/src/fsfw/serialize/SerializeIF.h @@ -61,6 +61,18 @@ class SerializeIF { */ virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, Endianness streamEndianness) const = 0; + /** + * Forwards to regular @serialize call with network endianness + */ + virtual ReturnValue_t serializeNe(uint8_t** buffer, size_t* size, size_t maxSize) { + return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK); + } + /** + * If endianness is not explicitly specified, use machine endianness + */ + virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize) { + return serialize(buffer, size, maxSize, SerializeIF::Endianness::MACHINE); + } /** * Gets the size of a object if it would be serialized in a buffer @@ -90,6 +102,18 @@ class SerializeIF { */ virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size, Endianness streamEndianness) = 0; + /** + * Forwards to regular @deSerialize call with network endianness + */ + virtual ReturnValue_t deSerializeNe(const uint8_t** buffer, size_t* size, size_t maxSize) { + return deSerialize(buffer, size, SerializeIF::Endianness::NETWORK); + } + /** + * If endianness is not explicitly specified, use machine endianness + */ + virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t *size, size_t maxSize) { + return deSerialize(buffer, size, SerializeIF::Endianness::MACHINE); + } /** * Helper method which can be used if serialization should be performed without any additional @@ -104,6 +128,18 @@ class SerializeIF { size_t tmpSize = 0; return serialize(&buffer, &tmpSize, maxSize, streamEndianness); } + /** + * Forwards to regular @serialize call with network endianness + */ + virtual ReturnValue_t serializeNe(uint8_t *buffer, size_t maxSize) const { + return serialize(buffer, maxSize, SerializeIF::Endianness::NETWORK); + } + /** + * If endianness is not explicitly specified, use machine endianness + */ + virtual ReturnValue_t serialize(uint8_t *buffer, size_t maxSize) const { + return serialize(buffer, maxSize, SerializeIF::Endianness::MACHINE); + } /** * Helper methods which can be used if deserialization should be performed without any additional @@ -117,6 +153,18 @@ class SerializeIF { Endianness streamEndianness) { return deSerialize(&buffer, &maxSize, streamEndianness); } + /** + * Forwards to regular @serialize call with network endianness + */ + virtual ReturnValue_t deSerializeNe(uint8_t *buffer, size_t maxSize) const { + return serialize(buffer, maxSize, SerializeIF::Endianness::NETWORK); + } + /** + * If endianness is not explicitly specified, use machine endianness + */ + virtual ReturnValue_t deSerialize(uint8_t *buffer, size_t maxSize) const { + return serialize(buffer, maxSize, SerializeIF::Endianness::MACHINE); + } }; #endif /* FSFW_SERIALIZE_SERIALIZEIF_H_ */