1
0
forked from fsfw/fsfw

working on updating SerializeIF, to quote Basti: This is going to be horrible

This commit is contained in:
Uli
2020-04-21 21:34:03 +02:00
parent 05c1330b68
commit a42832ca01
35 changed files with 389 additions and 341 deletions

View File

@ -68,13 +68,13 @@ ReturnValue_t Type::serialize(uint8_t** buffer, uint32_t* size,
return result;
}
result = SerializeAdapter<uint8_t>::serialize(&ptc, buffer, size, max_size,
result = SerializeAdapter::serialize(&ptc, buffer, size, max_size,
bigEndian);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = SerializeAdapter<uint8_t>::serialize(&pfc, buffer, size, max_size,
result = SerializeAdapter::serialize(&pfc, buffer, size, max_size,
bigEndian);
return result;
@ -83,20 +83,20 @@ ReturnValue_t Type::serialize(uint8_t** buffer, uint32_t* size,
uint32_t Type::getSerializedSize() const {
uint8_t dontcare = 0;
return 2 * SerializeAdapter<uint8_t>::getSerializedSize(&dontcare);
return 2 * SerializeAdapter::getSerializedSize(&dontcare);
}
ReturnValue_t Type::deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian) {
uint8_t ptc;
uint8_t pfc;
ReturnValue_t result = SerializeAdapter<uint8_t>::deSerialize(&ptc, buffer,
ReturnValue_t result = SerializeAdapter::deSerialize(&ptc, buffer,
size, bigEndian);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = SerializeAdapter<uint8_t>::deSerialize(&pfc, buffer, size,
result = SerializeAdapter::deSerialize(&pfc, buffer, size,
bigEndian);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;

View File

@ -22,7 +22,7 @@ public:
Type(ActualType_t actualType);
Type(const Type& type);
Type(const Type &type);
Type& operator=(Type rhs);
@ -30,8 +30,8 @@ public:
operator ActualType_t() const;
bool operator==(const Type& rhs);
bool operator!=(const Type& rhs);
bool operator==(const Type &rhs);
bool operator!=(const Type &rhs);
uint8_t getSize() const;
@ -39,13 +39,13 @@ public:
static ActualType_t getActualType(uint8_t ptc, uint8_t pfc);
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const;
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size,
size_t maxSize, Endianness streamEndianness) const override;
virtual uint32_t getSerializedSize() const;
virtual size_t getSerializedSize() const override;
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian);
virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) override;
private:
ActualType_t actualType;

View File

@ -49,7 +49,7 @@ public:
const uint32_t max_size, bool bigEndian) const {
iterator iter = this->begin();
uint8_t count = this->countRight(iter);
ReturnValue_t result = SerializeAdapter<uint8_t>::serialize(&count,
ReturnValue_t result = SerializeAdapter::serialize(&count,
buffer, size, max_size, bigEndian);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;

View File

@ -4,7 +4,6 @@
#include <framework/globalfunctions/matching/SerializeableMatcherIF.h>
#include <framework/serialize/SerializeAdapter.h>
template<typename T>
class RangeMatcher: public SerializeableMatcherIF<T> {
public:
@ -27,34 +26,40 @@ public:
}
}
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const {
ReturnValue_t result = SerializeAdapter<T>::serialize(&lowerBound, buffer, size, max_size, bigEndian);
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t max_size,
SerializeIF::Endianness streamEndianness) const override {
ReturnValue_t result = SerializeAdapter::serialize(&lowerBound, buffer,
size, max_size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = SerializeAdapter<T>::serialize(&upperBound, buffer, size, max_size, bigEndian);
result = SerializeAdapter::serialize(&upperBound, buffer, size,
max_size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return SerializeAdapter<bool>::serialize(&inverted, buffer, size, max_size, bigEndian);
return SerializeAdapter::serialize(&inverted, buffer, size, max_size,
streamEndianness);
}
uint32_t getSerializedSize() const {
uint32_t getSerializedSize() const override {
return sizeof(lowerBound) + sizeof(upperBound) + sizeof(bool);
}
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian) {
ReturnValue_t result = SerializeAdapter<T>::deSerialize(&lowerBound, buffer, size, bigEndian);
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
SerializeIF::Endianness streamEndianness) override {
ReturnValue_t result = SerializeAdapter::deSerialize(&lowerBound,
buffer, size, streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = SerializeAdapter<T>::deSerialize(&upperBound, buffer, size, bigEndian);
result = SerializeAdapter::deSerialize(&upperBound, buffer, size,
streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return SerializeAdapter<bool>::deSerialize(&inverted, buffer, size, bigEndian);
return SerializeAdapter::deSerialize(&inverted, buffer, size,
streamEndianness);
}
protected:
bool doMatch(T input) {