update serialize IF

This commit is contained in:
Robin Müller 2022-07-27 21:07:34 +02:00
parent 93acac02f5
commit 85dbef20b0
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -59,18 +59,20 @@ class SerializeIF {
* - @c RETURN_FAILED Generic error * - @c RETURN_FAILED Generic error
* - @c RETURN_OK Successful serialization * - @c RETURN_OK Successful serialization
*/ */
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, [[nodiscard]] virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const = 0; Endianness streamEndianness) const = 0;
/** /**
* Forwards to regular @serialize call with big (network) endianness * Forwards to regular @serialize call with big (network) endianness
*/ */
virtual ReturnValue_t serializeBe(uint8_t **buffer, size_t *size, size_t maxSize) const { [[nodiscard]] virtual ReturnValue_t serializeBe(uint8_t **buffer, size_t *size,
size_t maxSize) const {
return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK); return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK);
} }
/** /**
* If endianness is not explicitly specified, use machine endianness * If endianness is not explicitly specified, use machine endianness
*/ */
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize) const { [[nodiscard]] virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size,
size_t maxSize) const {
return serialize(buffer, size, maxSize, SerializeIF::Endianness::MACHINE); return serialize(buffer, size, maxSize, SerializeIF::Endianness::MACHINE);
} }
@ -123,7 +125,7 @@ class SerializeIF {
* @param streamEndianness * @param streamEndianness
* @return * @return
*/ */
virtual ReturnValue_t serialize(uint8_t *buffer, size_t maxSize, [[nodiscard]] virtual ReturnValue_t serialize(uint8_t *buffer, size_t maxSize,
Endianness streamEndianness) const { Endianness streamEndianness) const {
size_t tmpSize = 0; size_t tmpSize = 0;
return serialize(&buffer, &tmpSize, maxSize, streamEndianness); return serialize(&buffer, &tmpSize, maxSize, streamEndianness);
@ -131,13 +133,13 @@ class SerializeIF {
/** /**
* Forwards to regular @serialize call with big (network) endianness * Forwards to regular @serialize call with big (network) endianness
*/ */
virtual ReturnValue_t serializeBe(uint8_t *buffer, size_t maxSize) const { [[nodiscard]] virtual ReturnValue_t serializeBe(uint8_t *buffer, size_t maxSize) const {
return serialize(buffer, maxSize, SerializeIF::Endianness::NETWORK); return serialize(buffer, maxSize, SerializeIF::Endianness::NETWORK);
} }
/** /**
* If endianness is not explicitly specified, use machine endianness * If endianness is not explicitly specified, use machine endianness
*/ */
virtual ReturnValue_t serialize(uint8_t *buffer, size_t maxSize) const { [[nodiscard]] virtual ReturnValue_t serialize(uint8_t *buffer, size_t maxSize) const {
return serialize(buffer, maxSize, SerializeIF::Endianness::MACHINE); return serialize(buffer, maxSize, SerializeIF::Endianness::MACHINE);
} }