added a few more methods
This commit is contained in:
parent
ddad97033d
commit
8e05fc0417
@ -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_ */
|
||||
|
Loading…
Reference in New Issue
Block a user