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

This commit is contained in:
Robin Müller 2022-07-23 10:28:13 +02:00
commit fd55de9e95

View File

@ -61,6 +61,18 @@ class SerializeIF {
*/ */
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, 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 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);
}
/** /**
* Forwards to regular @serialize call with network endianness * Forwards to regular @serialize call with network endianness
@ -130,6 +142,18 @@ class SerializeIF {
size_t tmpSize = 0; size_t tmpSize = 0;
return serialize(&buffer, &tmpSize, maxSize, streamEndianness); 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 * Helper methods which can be used if deserialization should be performed without any additional
@ -143,6 +167,18 @@ class SerializeIF {
Endianness streamEndianness) { Endianness streamEndianness) {
return deSerialize(&buffer, &maxSize, 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_ */ #endif /* FSFW_SERIALIZE_SERIALIZEIF_H_ */