compiling again
This commit is contained in:
parent
6802ff7d71
commit
d7bff31a4c
@ -131,11 +131,11 @@ ReturnValue_t DataSetBase::unlockDataPool() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DataSetBase::serialize(uint8_t** buffer, size_t* size,
|
ReturnValue_t DataSetBase::serialize(uint8_t** buffer, size_t* size,
|
||||||
const size_t maxSize, bool bigEndian) const {
|
const size_t maxSize, SerializeIF::Endianness streamEndianness) const {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
||||||
for (uint16_t count = 0; count < fillCount; count++) {
|
for (uint16_t count = 0; count < fillCount; count++) {
|
||||||
result = registeredVariables[count]->serialize(buffer, size, maxSize,
|
result = registeredVariables[count]->serialize(buffer, size, maxSize,
|
||||||
bigEndian);
|
streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -144,11 +144,11 @@ ReturnValue_t DataSetBase::serialize(uint8_t** buffer, size_t* size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DataSetBase::deSerialize(const uint8_t** buffer, size_t* size,
|
ReturnValue_t DataSetBase::deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian) {
|
SerializeIF::Endianness streamEndianness) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
||||||
for (uint16_t count = 0; count < fillCount; count++) {
|
for (uint16_t count = 0; count < fillCount; count++) {
|
||||||
result = registeredVariables[count]->deSerialize(buffer, size,
|
result = registeredVariables[count]->deSerialize(buffer, size,
|
||||||
bigEndian);
|
streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -105,10 +105,11 @@ public:
|
|||||||
|
|
||||||
/* SerializeIF implementations */
|
/* SerializeIF implementations */
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||||
const size_t maxSize, bool bigEndian) const override;
|
const size_t maxSize,
|
||||||
|
SerializeIF::Endianness streamEndianness) const override;
|
||||||
virtual size_t getSerializedSize() const override;
|
virtual size_t getSerializedSize() const override;
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian) override;
|
SerializeIF::Endianness streamEndianness) override;
|
||||||
|
|
||||||
// SHOULDDO we could use a linked list of datapool variables
|
// SHOULDDO we could use a linked list of datapool variables
|
||||||
//!< This definition sets the maximum number of variables to
|
//!< This definition sets the maximum number of variables to
|
||||||
|
@ -24,8 +24,9 @@ PoolRawAccessHelper::~PoolRawAccessHelper() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PoolRawAccessHelper::serialize(uint8_t **buffer, size_t *size,
|
ReturnValue_t PoolRawAccessHelper::serialize(uint8_t **buffer, size_t *size,
|
||||||
const size_t max_size, bool bigEndian) {
|
const size_t max_size, SerializeIF::Endianness streamEndianness) {
|
||||||
SerializationArgs serializationArgs = {buffer, size, max_size, bigEndian};
|
SerializationArgs serializationArgs = {buffer, size, max_size,
|
||||||
|
streamEndianness};
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
size_t remainingParametersSize = numberOfParameters * 4;
|
size_t remainingParametersSize = numberOfParameters * 4;
|
||||||
for(uint8_t count=0; count < numberOfParameters; count++) {
|
for(uint8_t count=0; count < numberOfParameters; count++) {
|
||||||
@ -44,9 +45,10 @@ ReturnValue_t PoolRawAccessHelper::serialize(uint8_t **buffer, size_t *size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PoolRawAccessHelper::serializeWithValidityMask(uint8_t ** buffer,
|
ReturnValue_t PoolRawAccessHelper::serializeWithValidityMask(uint8_t ** buffer,
|
||||||
size_t * size, const size_t max_size, bool bigEndian) {
|
size_t * size, const size_t max_size,
|
||||||
|
SerializeIF::Endianness streamEndianness) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
SerializationArgs argStruct = {buffer, size, max_size, bigEndian};
|
SerializationArgs argStruct = {buffer, size, max_size, streamEndianness};
|
||||||
size_t remainingParametersSize = numberOfParameters * 4;
|
size_t remainingParametersSize = numberOfParameters * 4;
|
||||||
uint8_t validityMaskSize = ceil((float)numberOfParameters/8.0);
|
uint8_t validityMaskSize = ceil((float)numberOfParameters/8.0);
|
||||||
uint8_t validityMask[validityMaskSize];
|
uint8_t validityMask[validityMaskSize];
|
||||||
@ -76,8 +78,8 @@ ReturnValue_t PoolRawAccessHelper::serializeCurrentPoolEntryIntoBuffer(
|
|||||||
bool withValidMask, uint8_t * validityMask) {
|
bool withValidMask, uint8_t * validityMask) {
|
||||||
uint32_t currentPoolId;
|
uint32_t currentPoolId;
|
||||||
// Deserialize current pool ID from pool ID buffer
|
// Deserialize current pool ID from pool ID buffer
|
||||||
ReturnValue_t result = AutoSerializeAdapter::deSerialize(¤tPoolId,
|
ReturnValue_t result = SerializeAdapter::deSerialize(¤tPoolId,
|
||||||
&poolIdBuffer,remainingParameters, false);
|
&poolIdBuffer,remainingParameters, SerializeIF::Endianness::MACHINE);
|
||||||
if(result != RETURN_OK) {
|
if(result != RETURN_OK) {
|
||||||
sif::debug << std::hex << "PoolRawAccessHelper: Error deSeralizing "
|
sif::debug << std::hex << "PoolRawAccessHelper: Error deSeralizing "
|
||||||
"pool IDs" << std::dec << std::endl;
|
"pool IDs" << std::dec << std::endl;
|
||||||
@ -109,8 +111,8 @@ ReturnValue_t PoolRawAccessHelper::handlePoolEntrySerialization(
|
|||||||
|
|
||||||
GlobDataSet currentDataSet;
|
GlobDataSet currentDataSet;
|
||||||
//debug << "Current array position: " << (int)arrayPosition << std::endl;
|
//debug << "Current array position: " << (int)arrayPosition << std::endl;
|
||||||
PoolRawAccess currentPoolRawAccess(currentPoolId,arrayPosition,
|
PoolRawAccess currentPoolRawAccess(currentPoolId, arrayPosition,
|
||||||
¤tDataSet,PoolVariableIF::VAR_READ);
|
¤tDataSet, PoolVariableIF::VAR_READ);
|
||||||
|
|
||||||
result = currentDataSet.read();
|
result = currentDataSet.read();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
@ -137,7 +139,7 @@ ReturnValue_t PoolRawAccessHelper::handlePoolEntrySerialization(
|
|||||||
}
|
}
|
||||||
|
|
||||||
result = currentDataSet.serialize(argStruct.buffer, argStruct.size,
|
result = currentDataSet.serialize(argStruct.buffer, argStruct.size,
|
||||||
argStruct.max_size, argStruct.bigEndian);
|
argStruct.max_size, argStruct.streamEndianness);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::debug << "Pool Raw Access Helper: Error serializing pool data with "
|
sif::debug << "Pool Raw Access Helper: Error serializing pool data with "
|
||||||
"ID 0x" << std::hex << currentPoolId << " into send buffer "
|
"ID 0x" << std::hex << currentPoolId << " into send buffer "
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
* @c RETURN_FAILED on failure
|
* @c RETURN_FAILED on failure
|
||||||
*/
|
*/
|
||||||
ReturnValue_t serialize(uint8_t ** buffer, size_t * size,
|
ReturnValue_t serialize(uint8_t ** buffer, size_t * size,
|
||||||
const size_t max_size, bool bigEndian);
|
const size_t max_size, SerializeIF::Endianness streamEndianness);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serializes data pool entries into provided buffer with the validity mask buffer
|
* Serializes data pool entries into provided buffer with the validity mask buffer
|
||||||
@ -56,7 +56,7 @@ public:
|
|||||||
* @c RETURN_FAILED on failure
|
* @c RETURN_FAILED on failure
|
||||||
*/
|
*/
|
||||||
ReturnValue_t serializeWithValidityMask(uint8_t ** buffer, size_t * size,
|
ReturnValue_t serializeWithValidityMask(uint8_t ** buffer, size_t * size,
|
||||||
const size_t max_size, bool bigEndian);
|
const size_t max_size, SerializeIF::Endianness streamEndianness);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -71,7 +71,7 @@ private:
|
|||||||
uint8_t ** buffer;
|
uint8_t ** buffer;
|
||||||
size_t * size;
|
size_t * size;
|
||||||
const size_t max_size;
|
const size_t max_size;
|
||||||
bool bigEndian;
|
SerializeIF::Endianness streamEndianness;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Helper function to serialize single pool entries
|
* Helper function to serialize single pool entries
|
||||||
|
@ -181,18 +181,20 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||||
const size_t max_size, bool bigEndian) const override {
|
const size_t max_size,
|
||||||
return SerializeAdapter<T>::serialize(&value, buffer, size, max_size,
|
SerializeIF::Endianness streamEndianness) const override {
|
||||||
bigEndian);
|
return SerializeAdapter::serialize(&value, buffer, size, max_size,
|
||||||
|
streamEndianness);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual size_t getSerializedSize() const {
|
virtual size_t getSerializedSize() const {
|
||||||
return SerializeAdapter<T>::getSerializedSize(&value);
|
return SerializeAdapter::getSerializedSize(&value);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian) {
|
SerializeIF::Endianness streamEndianness) {
|
||||||
return SerializeAdapter<T>::deSerialize(&value, buffer, size, bigEndian);
|
return SerializeAdapter::deSerialize(&value, buffer, size,
|
||||||
|
streamEndianness);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -109,10 +109,10 @@ public:
|
|||||||
const T &operator [](int i) const {return value[i];}
|
const T &operator [](int i) const {return value[i];}
|
||||||
|
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||||
const size_t max_size, bool bigEndian) const override;
|
size_t max_size, Endianness streamEndianness) const override;
|
||||||
virtual size_t getSerializedSize() const override;
|
virtual size_t getSerializedSize() const override;
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian) override;
|
Endianness streamEndianness) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is a call to read the array's values
|
* @brief This is a call to read the array's values
|
||||||
|
@ -79,12 +79,13 @@ inline ReturnValue_t GlobPoolVector<T, vectorSize>::commitWithoutLock() {
|
|||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template<typename T, uint16_t vectorSize>
|
||||||
inline ReturnValue_t GlobPoolVector<T, vectorSize>::serialize(uint8_t** buffer,
|
inline ReturnValue_t GlobPoolVector<T, vectorSize>::serialize(uint8_t** buffer,
|
||||||
size_t* size, const size_t max_size, bool bigEndian) const {
|
size_t* size, size_t max_size,
|
||||||
|
SerializeIF::Endianness streamEndianness) const {
|
||||||
uint16_t i;
|
uint16_t i;
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
for (i = 0; i < vectorSize; i++) {
|
for (i = 0; i < vectorSize; i++) {
|
||||||
result = SerializeAdapter<T>::serialize(&(value[i]), buffer, size,
|
result = SerializeAdapter::serialize(&(value[i]), buffer, size,
|
||||||
max_size, bigEndian);
|
max_size, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -94,17 +95,18 @@ inline ReturnValue_t GlobPoolVector<T, vectorSize>::serialize(uint8_t** buffer,
|
|||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template<typename T, uint16_t vectorSize>
|
||||||
inline size_t GlobPoolVector<T, vectorSize>::getSerializedSize() const {
|
inline size_t GlobPoolVector<T, vectorSize>::getSerializedSize() const {
|
||||||
return vectorSize * SerializeAdapter<T>::getSerializedSize(value);
|
return vectorSize * SerializeAdapter::getSerializedSize(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template<typename T, uint16_t vectorSize>
|
||||||
inline ReturnValue_t GlobPoolVector<T, vectorSize>::deSerialize(
|
inline ReturnValue_t GlobPoolVector<T, vectorSize>::deSerialize(
|
||||||
const uint8_t** buffer, size_t* size, bool bigEndian) {
|
const uint8_t** buffer, size_t* size,
|
||||||
|
SerializeIF::Endianness streamEndianness) {
|
||||||
uint16_t i;
|
uint16_t i;
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
for (i = 0; i < vectorSize; i++) {
|
for (i = 0; i < vectorSize; i++) {
|
||||||
result = SerializeAdapter<T>::deSerialize(&(value[i]), buffer, size,
|
result = SerializeAdapter::deSerialize(&(value[i]), buffer, size,
|
||||||
bigEndian);
|
streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,9 @@ protected:
|
|||||||
uint32_t parameterId;
|
uint32_t parameterId;
|
||||||
uint8_t valid;
|
uint8_t valid;
|
||||||
ReturnValue_t readWithoutLock() {
|
ReturnValue_t readWithoutLock() {
|
||||||
uint8_t arrayIndex = DataPool::PIDToArrayIndex(parameterId);
|
uint8_t arrayIndex = GlobalDataPool::PIDToArrayIndex(parameterId);
|
||||||
PoolEntry<T> *read_out = ::dataPool.getData<T>(
|
PoolEntry<T> *read_out = glob::dataPool.getData<T>(
|
||||||
DataPool::PIDToDataPoolId(parameterId), arrayIndex);
|
GlobalDataPool::PIDToDataPoolId(parameterId), arrayIndex);
|
||||||
if (read_out != NULL) {
|
if (read_out != NULL) {
|
||||||
valid = read_out->valid;
|
valid = read_out->valid;
|
||||||
value = read_out->address[arrayIndex];
|
value = read_out->address[arrayIndex];
|
||||||
|
@ -145,27 +145,29 @@ ReturnValue_t PoolRawAccess::getEntryEndianSafe(uint8_t* buffer,
|
|||||||
|
|
||||||
|
|
||||||
ReturnValue_t PoolRawAccess::serialize(uint8_t** buffer, size_t* size,
|
ReturnValue_t PoolRawAccess::serialize(uint8_t** buffer, size_t* size,
|
||||||
const size_t max_size, bool bigEndian) const {
|
size_t maxSize, Endianness streamEndianness) const {
|
||||||
if (typeSize + *size <= max_size) {
|
//TODO integer overflow
|
||||||
if (bigEndian) {
|
if (typeSize + *size <= maxSize) {
|
||||||
|
#warning use endian swapper
|
||||||
|
if (1) {
|
||||||
#ifndef BYTE_ORDER_SYSTEM
|
#ifndef BYTE_ORDER_SYSTEM
|
||||||
#error BYTE_ORDER_SYSTEM not defined
|
#error BYTE_ORDER_SYSTEM not defined
|
||||||
#elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN
|
#elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN
|
||||||
for (uint8_t count = 0; count < typeSize; count++) {
|
for (uint8_t count = 0; count < typeSize; count++) {
|
||||||
(*buffer)[count] = value[typeSize - count - 1];
|
(*buffer)[count] = value[typeSize - count - 1];
|
||||||
}
|
}
|
||||||
#elif BYTE_ORDER_SYSTEM == BIG_ENDIAN
|
#elif BYTE_ORDER_SYSTEM == BIG_ENDIAN
|
||||||
memcpy(*buffer, value, typeSize);
|
memcpy(*buffer, value, typeSize);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
memcpy(*buffer, value, typeSize);
|
memcpy(*buffer, value, typeSize);
|
||||||
}
|
}
|
||||||
*size += typeSize;
|
*size += typeSize;
|
||||||
(*buffer) += typeSize;
|
(*buffer) += typeSize;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
} else {
|
} else {
|
||||||
return SerializeIF::BUFFER_TOO_SHORT;
|
return SerializeIF::BUFFER_TOO_SHORT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -231,28 +233,26 @@ size_t PoolRawAccess::getSerializedSize() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PoolRawAccess::deSerialize(const uint8_t** buffer, size_t* size,
|
ReturnValue_t PoolRawAccess::deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian) {
|
Endianness streamEndianness) {
|
||||||
// TODO: Needs to be tested!!!
|
|
||||||
if (*size >= typeSize) {
|
if (*size >= typeSize) {
|
||||||
*size -= typeSize;
|
*size -= typeSize;
|
||||||
if (bigEndian) {
|
if (1) {
|
||||||
#ifndef BYTE_ORDER_SYSTEM
|
#ifndef BYTE_ORDER_SYSTEM
|
||||||
#error BYTE_ORDER_SYSTEM not defined
|
#error BYTE_ORDER_SYSTEM not defined
|
||||||
#elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN
|
#elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN
|
||||||
for (uint8_t count = 0; count < typeSize; count++) {
|
for (uint8_t count = 0; count < typeSize; count++) {
|
||||||
value[count] = (*buffer)[typeSize - count - 1];
|
value[count] = (*buffer)[typeSize - count - 1];
|
||||||
}
|
}
|
||||||
#elif BYTE_ORDER_SYSTEM == BIG_ENDIAN
|
#elif BYTE_ORDER_SYSTEM == BIG_ENDIAN
|
||||||
memcpy(value, *buffer, typeSize);
|
memcpy(value, *buffer, typeSize);
|
||||||
#endif
|
#endif
|
||||||
}
|
} else {
|
||||||
else {
|
memcpy(value, *buffer, typeSize);
|
||||||
memcpy(value, *buffer, typeSize);
|
}
|
||||||
}
|
*buffer += typeSize;
|
||||||
*buffer += typeSize;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
} else {
|
||||||
}
|
return SerializeIF::STREAM_TOO_SHORT;
|
||||||
else {
|
}
|
||||||
return SerializeIF::STREAM_TOO_SHORT;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -69,8 +69,13 @@ public:
|
|||||||
* @return - @c RETURN_OK if serialization was successfull
|
* @return - @c RETURN_OK if serialization was successfull
|
||||||
* - @c SerializeIF::BUFFER_TOO_SHORT if range check failed
|
* - @c SerializeIF::BUFFER_TOO_SHORT if range check failed
|
||||||
*/
|
*/
|
||||||
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
ReturnValue_t serialize(uint8_t **buffer, size_t *size,
|
||||||
const size_t max_size, bool bigEndian) const;
|
size_t maxSize, Endianness streamEndianness) const override;
|
||||||
|
|
||||||
|
size_t getSerializedSize() const override;
|
||||||
|
|
||||||
|
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
|
Endianness streamEndianness) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* With this method, the content can be set from a big endian buffer safely.
|
* With this method, the content can be set from a big endian buffer safely.
|
||||||
@ -130,11 +135,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
uint16_t getSizeTillEnd() const;
|
uint16_t getSizeTillEnd() const;
|
||||||
|
|
||||||
size_t getSerializedSize() const;
|
|
||||||
|
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
|
||||||
bool bigEndian);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is a call to read the value from the global data pool.
|
* @brief This is a call to read the value from the global data pool.
|
||||||
* @details
|
* @details
|
||||||
|
@ -173,7 +173,7 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid) {
|
|||||||
}
|
}
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
result = dataSet->serializeLocalPoolIds(&storePtr, &size,
|
result = dataSet->serializeLocalPoolIds(&storePtr, &size,
|
||||||
expectedSize, false);
|
expectedSize, SerializeIF::Endianness::BIG);
|
||||||
if(expectedSize != size) {
|
if(expectedSize != size) {
|
||||||
sif::error << "HousekeepingManager::generateSetStructurePacket: "
|
sif::error << "HousekeepingManager::generateSetStructurePacket: "
|
||||||
"Expected size is not equal to serialized size" << std::endl;
|
"Expected size is not equal to serialized size" << std::endl;
|
||||||
@ -198,10 +198,11 @@ ReturnValue_t LocalDataPoolManager::serializeHkPacketIntoStore(
|
|||||||
|
|
||||||
if(appendValidityBuffer) {
|
if(appendValidityBuffer) {
|
||||||
result = dataSet->serializeWithValidityBuffer(&storePtr,
|
result = dataSet->serializeWithValidityBuffer(&storePtr,
|
||||||
&size, hkSize, false);
|
&size, hkSize, SerializeIF::Endianness::MACHINE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = dataSet->serialize(&storePtr, &size, hkSize, false);
|
result = dataSet->serialize(&storePtr, &size, hkSize,
|
||||||
|
SerializeIF::Endianness::MACHINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
@ -32,7 +32,8 @@ ReturnValue_t LocalDataSet::lockDataPool(uint32_t timeoutMs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalDataSet::serializeWithValidityBuffer(uint8_t **buffer,
|
ReturnValue_t LocalDataSet::serializeWithValidityBuffer(uint8_t **buffer,
|
||||||
size_t *size, const size_t maxSize, bool bigEndian) const {
|
size_t *size, size_t maxSize,
|
||||||
|
SerializeIF::Endianness streamEndianness) const {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
||||||
uint8_t validityMaskSize = std::ceil(static_cast<float>(fillCount)/8.0);
|
uint8_t validityMaskSize = std::ceil(static_cast<float>(fillCount)/8.0);
|
||||||
uint8_t validityMask[validityMaskSize];
|
uint8_t validityMask[validityMaskSize];
|
||||||
@ -52,7 +53,7 @@ ReturnValue_t LocalDataSet::serializeWithValidityBuffer(uint8_t **buffer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = registeredVariables[count]->serialize(buffer, size, maxSize,
|
result = registeredVariables[count]->serialize(buffer, size, maxSize,
|
||||||
bigEndian);
|
streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -69,11 +70,12 @@ ReturnValue_t LocalDataSet::unlockDataPool() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalDataSet::serializeLocalPoolIds(uint8_t** buffer,
|
ReturnValue_t LocalDataSet::serializeLocalPoolIds(uint8_t** buffer,
|
||||||
size_t* size, const size_t maxSize, bool bigEndian) const {
|
size_t* size, size_t maxSize,
|
||||||
|
SerializeIF::Endianness streamEndianness) const {
|
||||||
for (uint16_t count = 0; count < fillCount; count++) {
|
for (uint16_t count = 0; count < fillCount; count++) {
|
||||||
lp_id_t currentPoolId = registeredVariables[count]->getDataPoolId();
|
lp_id_t currentPoolId = registeredVariables[count]->getDataPoolId();
|
||||||
auto result = AutoSerializeAdapter::serialize(¤tPoolId, buffer,
|
auto result = SerializeAdapter::serialize(¤tPoolId, buffer,
|
||||||
size, maxSize, bigEndian);
|
size, maxSize, streamEndianness);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "LocalDataSet::serializeLocalPoolIds: Serialization"
|
sif::warning << "LocalDataSet::serializeLocalPoolIds: Serialization"
|
||||||
" error!" << std::endl;
|
" error!" << std::endl;
|
||||||
|
@ -68,10 +68,12 @@ public:
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t serializeWithValidityBuffer(uint8_t** buffer,
|
ReturnValue_t serializeWithValidityBuffer(uint8_t** buffer,
|
||||||
size_t* size, const size_t maxSize, bool bigEndian) const;
|
size_t* size, size_t maxSize,
|
||||||
|
SerializeIF::Endianness streamEndianness) const;
|
||||||
|
|
||||||
ReturnValue_t serializeLocalPoolIds(uint8_t** buffer,
|
ReturnValue_t serializeLocalPoolIds(uint8_t** buffer,
|
||||||
size_t* size, const size_t maxSize, bool bigEndian) const;
|
size_t* size, size_t maxSize,
|
||||||
|
SerializeIF::Endianness streamEndianness) const;
|
||||||
protected:
|
protected:
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -84,11 +84,11 @@ public:
|
|||||||
void setValid(bool validity) override;
|
void setValid(bool validity) override;
|
||||||
uint8_t getValid() const;
|
uint8_t getValid() const;
|
||||||
|
|
||||||
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
const size_t max_size, bool bigEndian) const override;
|
SerializeIF::Endianness streamEndianness) const override;
|
||||||
virtual size_t getSerializedSize() const override;
|
virtual size_t getSerializedSize() const override;
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian) override;
|
SerializeIF::Endianness streamEndianness) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is a call to read the array's values
|
* @brief This is a call to read the array's values
|
||||||
|
@ -133,20 +133,20 @@ inline uint8_t LocalPoolVar<T>::getValid() const {
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline ReturnValue_t LocalPoolVar<T>::serialize(uint8_t** buffer, size_t* size,
|
inline ReturnValue_t LocalPoolVar<T>::serialize(uint8_t** buffer, size_t* size,
|
||||||
const size_t max_size, bool bigEndian) const {
|
const size_t max_size, SerializeIF::Endianness streamEndianness) const {
|
||||||
return AutoSerializeAdapter::serialize(&value,
|
return SerializeAdapter::serialize(&value,
|
||||||
buffer, size ,max_size, bigEndian);
|
buffer, size ,max_size, streamEndianness);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline size_t LocalPoolVar<T>::getSerializedSize() const {
|
inline size_t LocalPoolVar<T>::getSerializedSize() const {
|
||||||
return AutoSerializeAdapter::getSerializedSize(&value);
|
return SerializeAdapter::getSerializedSize(&value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline ReturnValue_t LocalPoolVar<T>::deSerialize(const uint8_t** buffer,
|
inline ReturnValue_t LocalPoolVar<T>::deSerialize(const uint8_t** buffer,
|
||||||
size_t* size, bool bigEndian) {
|
size_t* size, SerializeIF::Endianness streamEndianness) {
|
||||||
return AutoSerializeAdapter::deSerialize(&value, buffer, size, bigEndian);
|
return SerializeAdapter::deSerialize(&value, buffer, size, streamEndianness);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -114,10 +114,11 @@ public:
|
|||||||
const T &operator [](int i) const;
|
const T &operator [](int i) const;
|
||||||
|
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||||
const size_t max_size, bool bigEndian) const override;
|
const size_t maxSize,
|
||||||
|
SerializeIF::Endianness streamEndiannes) const override;
|
||||||
virtual size_t getSerializedSize() const override;
|
virtual size_t getSerializedSize() const override;
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
bool bigEndian) override;
|
SerializeIF::Endianness streamEndianness) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is a call to read the array's values
|
* @brief This is a call to read the array's values
|
||||||
|
@ -125,11 +125,12 @@ inline const T& LocalPoolVector<T, vectorSize>::operator [](int i) const {
|
|||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template<typename T, uint16_t vectorSize>
|
||||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::serialize(uint8_t** buffer,
|
inline ReturnValue_t LocalPoolVector<T, vectorSize>::serialize(uint8_t** buffer,
|
||||||
size_t* size, const size_t max_size, bool bigEndian) const {
|
size_t* size, size_t maxSize,
|
||||||
|
SerializeIF::Endianness streamEndianness) const {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
||||||
for (uint16_t i = 0; i < vectorSize; i++) {
|
for (uint16_t i = 0; i < vectorSize; i++) {
|
||||||
result = SerializeAdapter<T>::serialize(&(value[i]), buffer, size,
|
result = SerializeAdapter::serialize(&(value[i]), buffer, size,
|
||||||
max_size, bigEndian);
|
maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -139,16 +140,17 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::serialize(uint8_t** buffer,
|
|||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template<typename T, uint16_t vectorSize>
|
||||||
inline size_t LocalPoolVector<T, vectorSize>::getSerializedSize() const {
|
inline size_t LocalPoolVector<T, vectorSize>::getSerializedSize() const {
|
||||||
return vectorSize * SerializeAdapter<T>::getSerializedSize(value);
|
return vectorSize * SerializeAdapter::getSerializedSize(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, uint16_t vectorSize>
|
template<typename T, uint16_t vectorSize>
|
||||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::deSerialize(
|
inline ReturnValue_t LocalPoolVector<T, vectorSize>::deSerialize(
|
||||||
const uint8_t** buffer, size_t* size, bool bigEndian) {
|
const uint8_t** buffer, size_t* size,
|
||||||
|
SerializeIF::Endianness streamEndianness) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
||||||
for (uint16_t i = 0; i < vectorSize; i++) {
|
for (uint16_t i = 0; i < vectorSize; i++) {
|
||||||
result = SerializeAdapter<T>::deSerialize(&(value[i]), buffer, size,
|
result = SerializeAdapter::deSerialize(&(value[i]), buffer, size,
|
||||||
bigEndian);
|
streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public:
|
|||||||
HasHealthIF::HealthState initilialState = HasHealthIF::HEALTHY) = 0;
|
HasHealthIF::HealthState initilialState = HasHealthIF::HEALTHY) = 0;
|
||||||
|
|
||||||
virtual uint32_t getPrintSize() = 0;
|
virtual uint32_t getPrintSize() = 0;
|
||||||
virtual void printAll(uint8_t *pointer, uint32_t maxSize) = 0;
|
virtual void printAll(uint8_t *pointer, size_t maxSize) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ReturnValue_t iterate(std::pair<object_id_t,HasHealthIF::HealthState> *value, bool reset = false) = 0;
|
virtual ReturnValue_t iterate(std::pair<object_id_t,HasHealthIF::HealthState> *value, bool reset = false) = 0;
|
||||||
|
@ -20,21 +20,12 @@ public:
|
|||||||
float getMax();
|
float getMax();
|
||||||
|
|
||||||
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||||
<<<<<<< HEAD
|
|
||||||
const size_t max_size, bool bigEndian) const;
|
|
||||||
|
|
||||||
size_t getSerializedSize() const;
|
|
||||||
|
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
|
||||||
bool bigEndian);
|
|
||||||
=======
|
|
||||||
size_t maxSize, Endianness streamEndianness) const override;
|
size_t maxSize, Endianness streamEndianness) const override;
|
||||||
|
|
||||||
size_t getSerializedSize() const override;
|
size_t getSerializedSize() const override;
|
||||||
|
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
Endianness streamEndianness) override;
|
Endianness streamEndianness) override;
|
||||||
>>>>>>> upstream/mohr_serialize
|
|
||||||
|
|
||||||
ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
|
ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
|
||||||
ParameterWrapper *parameterWrapper,
|
ParameterWrapper *parameterWrapper,
|
||||||
|
@ -36,18 +36,18 @@ ReturnValue_t SerialBufferAdapter<T>::serialize(uint8_t** buffer, size_t* size,
|
|||||||
maxSize, streamEndianness);
|
maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
if (constBuffer != nullptr) {
|
if (constBuffer != nullptr) {
|
||||||
memcpy(*buffer_, this->constBuffer, bufferLength);
|
memcpy(*buffer, this->constBuffer, bufferLength);
|
||||||
}
|
}
|
||||||
else if (buffer != nullptr) {
|
else if (buffer != nullptr) {
|
||||||
// This will propably be never reached, constBuffer should always be
|
// This will propably be never reached, constBuffer should always be
|
||||||
// set if non-const buffer is set.
|
// set if non-const buffer is set.
|
||||||
memcpy(*buffer_, this->buffer, bufferLength);
|
memcpy(*buffer, this->buffer, bufferLength);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
*size_ += bufferLength;
|
*size += bufferLength;
|
||||||
(*buffer_) += bufferLength;
|
(*buffer) += bufferLength;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,30 +39,25 @@ public:
|
|||||||
*/
|
*/
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
SerialFixedArrayListAdapter(Args... args) :
|
SerialFixedArrayListAdapter(Args... args) :
|
||||||
FixedArrayList<BUFFER_TYPE, MAX_SIZE, count_t>(std::forward<Args>(args)...)
|
FixedArrayList<BUFFER_TYPE, MAX_SIZE, count_t>(
|
||||||
{}
|
std::forward<Args>(args)...){}
|
||||||
|
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||||
const size_t max_size, bool bigEndian) const override {
|
size_t maxSize, Endianness streamEndianness) const {
|
||||||
return SerialArrayListAdapter<BUFFER_TYPE, count_t>::serialize(this,
|
return SerialArrayListAdapter<BUFFER_TYPE, count_t>::serialize(this,
|
||||||
buffer, size, max_size, bigEndian);
|
buffer, size, maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
size_t getSerializedSize() const {
|
||||||
size_t maxSize, Endianness streamEndianness) const {
|
return SerialArrayListAdapter<BUFFER_TYPE, count_t>::getSerializedSize(this);
|
||||||
return SerialArrayListAdapter<T, count_t>::serialize(this, buffer, size, maxSize, streamEndianness);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
size_t getSerializedSize() const {
|
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
return SerialArrayListAdapter<T, count_t>::getSerializedSize(this);
|
Endianness streamEndianness) {
|
||||||
}
|
return SerialArrayListAdapter<BUFFER_TYPE, count_t>::deSerialize(this,
|
||||||
|
buffer, size, streamEndianness);
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
|
||||||
Endianness streamEndianness) {
|
|
||||||
return SerialArrayListAdapter<T, count_t>::deSerialize(this, buffer, size, streamEndianness);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* SERIALFIXEDARRAYLISTADAPTER_H_ */
|
#endif /* SERIALFIXEDARRAYLISTADAPTER_H_ */
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
#define SERIALIZEADAPTER_H_
|
#define SERIALIZEADAPTER_H_
|
||||||
|
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
#include <framework/serialize/EndianSwapper.h>
|
||||||
|
#include <framework/container/IsDerivedFrom.h>
|
||||||
#include <framework/serialize/SerializeIF.h>
|
#include <framework/serialize/SerializeIF.h>
|
||||||
#include <framework/serialize/SerializeAdapterInternal.h>
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,118 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file SerializeAdapterInternal.h
|
|
||||||
*
|
|
||||||
* @date 13.04.2020
|
|
||||||
* @author R. Mueller
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef FRAMEWORK_SERIALIZE_SERIALIZEADAPTERINTERNAL_H_
|
|
||||||
#define FRAMEWORK_SERIALIZE_SERIALIZEADAPTERINTERNAL_H_
|
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
|
||||||
#include <framework/container/IsDerivedFrom.h>
|
|
||||||
#include <framework/serialize/EndianSwapper.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This template specialization will be chosen for fundamental types or
|
|
||||||
* anything else not implementing SerializeIF, based on partial
|
|
||||||
* template specialization.
|
|
||||||
* @tparam T
|
|
||||||
* @tparam
|
|
||||||
*/
|
|
||||||
template<typename T, int>
|
|
||||||
class SerializeAdapter_ {
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param object
|
|
||||||
* @param buffer
|
|
||||||
* @param size
|
|
||||||
* @param max_size
|
|
||||||
* @param bigEndian
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static ReturnValue_t serialize(const T* object, uint8_t** buffer,
|
|
||||||
size_t* size, const size_t max_size, bool bigEndian) {
|
|
||||||
// function eventuelly serializes structs here.
|
|
||||||
// does this work on every architecture?
|
|
||||||
// static_assert(std::is_fundamental<T>::value);
|
|
||||||
size_t ignoredSize = 0;
|
|
||||||
if (size == nullptr) {
|
|
||||||
size = &ignoredSize;
|
|
||||||
}
|
|
||||||
if (sizeof(T) + *size <= max_size) {
|
|
||||||
T tmp;
|
|
||||||
if (bigEndian) {
|
|
||||||
tmp = EndianSwapper::swap<T>(*object);
|
|
||||||
} else {
|
|
||||||
tmp = *object;
|
|
||||||
}
|
|
||||||
memcpy(*buffer, &tmp, sizeof(T));
|
|
||||||
*size += sizeof(T);
|
|
||||||
(*buffer) += sizeof(T);
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
} else {
|
|
||||||
return SerializeIF::BUFFER_TOO_SHORT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deserialize buffer into object
|
|
||||||
* @param object [out] Object to be deserialized with buffer data
|
|
||||||
* @param buffer contains the data. Non-Const pointer to non-const
|
|
||||||
* pointer to const data.
|
|
||||||
* @param size Size to deSerialize. wil be decremented by sizeof(T)
|
|
||||||
* @param bigEndian Specify endianness
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
ReturnValue_t deSerialize(T* object, const uint8_t** buffer, size_t* size,
|
|
||||||
bool bigEndian) {
|
|
||||||
T tmp;
|
|
||||||
if (*size >= sizeof(T)) {
|
|
||||||
*size -= sizeof(T);
|
|
||||||
memcpy(&tmp, *buffer, sizeof(T));
|
|
||||||
if (bigEndian) {
|
|
||||||
*object = EndianSwapper::swap<T>(tmp);
|
|
||||||
} else {
|
|
||||||
*object = tmp;
|
|
||||||
}
|
|
||||||
*buffer += sizeof(T);
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
} else {
|
|
||||||
return SerializeIF::STREAM_TOO_SHORT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t getSerializedSize(const T * object) {
|
|
||||||
return sizeof(T);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This template specialization will be chosen for class derived from
|
|
||||||
* SerializeIF, based on partial template specialization.
|
|
||||||
* @tparam T
|
|
||||||
* @tparam
|
|
||||||
*/
|
|
||||||
template<typename T>
|
|
||||||
class SerializeAdapter_<T, true> {
|
|
||||||
public:
|
|
||||||
ReturnValue_t serialize(const T* object, uint8_t** buffer, size_t* size,
|
|
||||||
const size_t max_size, bool bigEndian) const {
|
|
||||||
size_t ignoredSize = 0;
|
|
||||||
if (size == NULL) {
|
|
||||||
size = &ignoredSize;
|
|
||||||
}
|
|
||||||
return object->serialize(buffer, size, max_size, bigEndian);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t getSerializedSize(const T* object) const {
|
|
||||||
return object->getSerializedSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t deSerialize(T* object, const uint8_t** buffer, size_t* size,
|
|
||||||
bool bigEndian) {
|
|
||||||
return object->deSerialize(buffer, size, bigEndian);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* FRAMEWORK_SERIALIZE_SERIALIZEADAPTERINTERNAL_H_ */
|
|
@ -84,7 +84,7 @@ void TmPacketStored::deletePacket() {
|
|||||||
void TmPacketStored::setStoreAddress(store_address_t setAddress) {
|
void TmPacketStored::setStoreAddress(store_address_t setAddress) {
|
||||||
storeAddress = setAddress;
|
storeAddress = setAddress;
|
||||||
const uint8_t *temp_data = NULL;
|
const uint8_t *temp_data = NULL;
|
||||||
uint32_t temp_size;
|
size_t temp_size;
|
||||||
if (!checkAndSetStore()) {
|
if (!checkAndSetStore()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user