replaced int32_t size by ssize_t (type trait trick)
This commit is contained in:
parent
87852e5f2a
commit
42838272a5
@ -201,7 +201,7 @@ public:
|
|||||||
return printSize;
|
return printSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
ReturnValue_t result = SerializeAdapter<uint32_t>::deSerialize(&this->_size,
|
ReturnValue_t result = SerializeAdapter<uint32_t>::deSerialize(&this->_size,
|
||||||
buffer, size, bigEndian);
|
buffer, size, bigEndian);
|
||||||
|
@ -80,7 +80,7 @@ size_t DataPoolParameterWrapper::getSerializedSize() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DataPoolParameterWrapper::deSerialize(const uint8_t** buffer,
|
ReturnValue_t DataPoolParameterWrapper::deSerialize(const uint8_t** buffer,
|
||||||
int32_t* size, bool bigEndian) {
|
ssize_t* size, bool bigEndian) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public:
|
|||||||
|
|
||||||
virtual size_t getSerializedSize() const;
|
virtual size_t getSerializedSize() const;
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian);
|
bool bigEndian);
|
||||||
|
|
||||||
ReturnValue_t copyFrom(const ParameterWrapper *from,
|
ReturnValue_t copyFrom(const ParameterWrapper *from,
|
||||||
|
@ -136,7 +136,7 @@ void DataSet::setValid(uint8_t valid) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DataSet::deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t DataSet::deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
ReturnValue_t result = RETURN_FAILED;
|
ReturnValue_t result = RETURN_FAILED;
|
||||||
for (uint16_t count = 0; count < fill_count; count++) {
|
for (uint16_t count = 0; count < fill_count; count++) {
|
||||||
|
@ -126,7 +126,7 @@ public:
|
|||||||
|
|
||||||
virtual size_t getSerializedSize() const;
|
virtual size_t getSerializedSize() const;
|
||||||
|
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian);
|
bool bigEndian);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -136,7 +136,7 @@ public:
|
|||||||
return SerializeAdapter<T>::getSerializedSize(&value);
|
return SerializeAdapter<T>::getSerializedSize(&value);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
return SerializeAdapter<T>::deSerialize(&value, buffer, size, bigEndian);
|
return SerializeAdapter<T>::deSerialize(&value, buffer, size, bigEndian);
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ size_t PoolRawAccess::getSerializedSize() const {
|
|||||||
return typeSize;
|
return typeSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PoolRawAccess::deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t PoolRawAccess::deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
*size -= typeSize;
|
*size -= typeSize;
|
||||||
if (*size >= 0) {
|
if (*size >= 0) {
|
||||||
|
@ -127,7 +127,7 @@ public:
|
|||||||
|
|
||||||
size_t getSerializedSize() const;
|
size_t getSerializedSize() const;
|
||||||
|
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian);
|
bool bigEndian);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -25,7 +25,7 @@ ReturnValue_t PoolRawAccessHelper::serialize(uint8_t **buffer, size_t *size,
|
|||||||
const size_t max_size, bool bigEndian) {
|
const size_t max_size, bool bigEndian) {
|
||||||
SerializationArgs serializationArgs = {buffer, size, max_size, bigEndian};
|
SerializationArgs serializationArgs = {buffer, size, max_size, bigEndian};
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
int32_t remainingParametersSize = numberOfParameters * 4;
|
ssize_t remainingParametersSize = numberOfParameters * 4;
|
||||||
for(uint8_t count=0; count < numberOfParameters; count++) {
|
for(uint8_t count=0; count < numberOfParameters; count++) {
|
||||||
result = serializeCurrentPoolEntryIntoBuffer(serializationArgs,
|
result = serializeCurrentPoolEntryIntoBuffer(serializationArgs,
|
||||||
&remainingParametersSize, false);
|
&remainingParametersSize, false);
|
||||||
@ -44,7 +44,7 @@ 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, bool bigEndian) {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
SerializationArgs argStruct = {buffer, size, max_size, bigEndian};
|
SerializationArgs argStruct = {buffer, size, max_size, bigEndian};
|
||||||
int32_t remainingParametersSize = numberOfParameters * 4;
|
ssize_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];
|
||||||
memset(validityMask,0, validityMaskSize);
|
memset(validityMask,0, validityMaskSize);
|
||||||
@ -68,7 +68,7 @@ ReturnValue_t PoolRawAccessHelper::serializeWithValidityMask(uint8_t ** buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PoolRawAccessHelper::serializeCurrentPoolEntryIntoBuffer(SerializationArgs argStruct,
|
ReturnValue_t PoolRawAccessHelper::serializeCurrentPoolEntryIntoBuffer(SerializationArgs argStruct,
|
||||||
int32_t * remainingParameters, bool withValidMask, uint8_t * validityMask) {
|
ssize_t * remainingParameters, 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 = AutoSerializeAdapter::deSerialize(¤tPoolId,
|
||||||
|
@ -85,10 +85,12 @@ private:
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t serializeCurrentPoolEntryIntoBuffer(SerializationArgs argStruct,
|
ReturnValue_t serializeCurrentPoolEntryIntoBuffer(SerializationArgs argStruct,
|
||||||
int32_t * remainingParameters, bool withValidMask = false, uint8_t * validityMask = NULL);
|
ssize_t * remainingParameters, bool withValidMask = false,
|
||||||
|
uint8_t * validityMask = nullptr);
|
||||||
|
|
||||||
ReturnValue_t handlePoolEntrySerialization(uint32_t currentPoolId,SerializationArgs argStruct,
|
ReturnValue_t handlePoolEntrySerialization(uint32_t currentPoolId,
|
||||||
bool withValidMask = false, uint8_t * validityMask = NULL);
|
SerializationArgs argStruct, bool withValidMask = false,
|
||||||
|
uint8_t * validityMask = nullptr);
|
||||||
|
|
||||||
ReturnValue_t checkRemainingSize(PoolRawAccess * currentPoolRawAccess,
|
ReturnValue_t checkRemainingSize(PoolRawAccess * currentPoolRawAccess,
|
||||||
bool * isSerialized, uint8_t * arrayPosition);
|
bool * isSerialized, uint8_t * arrayPosition);
|
||||||
|
@ -203,7 +203,7 @@ public:
|
|||||||
return SerializeAdapter<T>::getSerializedSize(&value);
|
return SerializeAdapter<T>::getSerializedSize(&value);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
return SerializeAdapter<T>::deSerialize(&value, buffer, size, bigEndian);
|
return SerializeAdapter<T>::deSerialize(&value, buffer, size, bigEndian);
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ public:
|
|||||||
return vector_size * SerializeAdapter<T>::getSerializedSize(value);
|
return vector_size * SerializeAdapter<T>::getSerializedSize(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
uint16_t i;
|
uint16_t i;
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
|
@ -31,7 +31,7 @@ size_t DeviceTmReportingWrapper::getSerializedSize() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceTmReportingWrapper::deSerialize(const uint8_t** buffer,
|
ReturnValue_t DeviceTmReportingWrapper::deSerialize(const uint8_t** buffer,
|
||||||
int32_t* size, bool bigEndian) {
|
ssize_t* size, bool bigEndian) {
|
||||||
ReturnValue_t result = SerializeAdapter<object_id_t>::deSerialize(&objectId,
|
ReturnValue_t result = SerializeAdapter<object_id_t>::deSerialize(&objectId,
|
||||||
buffer, size, bigEndian);
|
buffer, size, bigEndian);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
@ -16,7 +16,7 @@ public:
|
|||||||
|
|
||||||
virtual size_t getSerializedSize() const;
|
virtual size_t getSerializedSize() const;
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian);
|
bool bigEndian);
|
||||||
private:
|
private:
|
||||||
object_id_t objectId;
|
object_id_t objectId;
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
size_t getSerializedSize() const {
|
size_t getSerializedSize() const {
|
||||||
return rangeMatcher.getSerializedSize();
|
return rangeMatcher.getSerializedSize();
|
||||||
}
|
}
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
return rangeMatcher.deSerialize(buffer, size, bigEndian);
|
return rangeMatcher.deSerialize(buffer, size, bigEndian);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#include <framework/serialize/SerializeAdapter.h>
|
|
||||||
#include <framework/globalfunctions/Type.h>
|
#include <framework/globalfunctions/Type.h>
|
||||||
#include <framework/serialize/SerializeAdapter.h>
|
#include <framework/serialize/SerializeAdapter.h>
|
||||||
|
|
||||||
@ -86,7 +85,7 @@ size_t Type::getSerializedSize() const {
|
|||||||
return 2 * SerializeAdapter<uint8_t>::getSerializedSize(&dontcare);
|
return 2 * SerializeAdapter<uint8_t>::getSerializedSize(&dontcare);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Type::deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t Type::deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
uint8_t ptc;
|
uint8_t ptc;
|
||||||
uint8_t pfc;
|
uint8_t pfc;
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
|
|
||||||
virtual size_t getSerializedSize() const;
|
virtual size_t getSerializedSize() const;
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian);
|
bool bigEndian);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -115,7 +115,7 @@ public:
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
return sizeof(lowerBound) + sizeof(upperBound) + sizeof(bool);
|
return sizeof(lowerBound) + sizeof(upperBound) + sizeof(bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
ReturnValue_t result = SerializeAdapter<T>::deSerialize(&lowerBound, buffer, size, bigEndian);
|
ReturnValue_t result = SerializeAdapter<T>::deSerialize(&lowerBound, buffer, size, bigEndian);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
@ -112,7 +112,7 @@ ReturnValue_t ParameterWrapper::deSerializeData(uint8_t startingRow,
|
|||||||
|
|
||||||
//treat from as a continuous Stream as we copy all of it
|
//treat from as a continuous Stream as we copy all of it
|
||||||
const uint8_t *fromAsStream = (const uint8_t *) from;
|
const uint8_t *fromAsStream = (const uint8_t *) from;
|
||||||
int32_t streamSize = fromRows * fromColumns * sizeof(T);
|
ssize_t streamSize = fromRows * fromColumns * sizeof(T);
|
||||||
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
|
||||||
@ -137,12 +137,12 @@ ReturnValue_t ParameterWrapper::deSerializeData(uint8_t startingRow,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ParameterWrapper::deSerialize(const uint8_t** buffer,
|
ReturnValue_t ParameterWrapper::deSerialize(const uint8_t** buffer,
|
||||||
int32_t* size, bool bigEndian) {
|
ssize_t* size, bool bigEndian) {
|
||||||
return deSerialize(buffer, size, bigEndian, 0);
|
return deSerialize(buffer, size, bigEndian, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ParameterWrapper::deSerialize(const uint8_t** buffer,
|
ReturnValue_t ParameterWrapper::deSerialize(const uint8_t** buffer,
|
||||||
int32_t* size, bool bigEndian, uint16_t startWritingAtIndex) {
|
ssize_t* size, bool bigEndian, uint16_t startWritingAtIndex) {
|
||||||
ParameterWrapper streamDescription;
|
ParameterWrapper streamDescription;
|
||||||
|
|
||||||
ReturnValue_t result = streamDescription.set(*buffer, *size, buffer, size);
|
ReturnValue_t result = streamDescription.set(*buffer, *size, buffer, size);
|
||||||
@ -153,8 +153,8 @@ ReturnValue_t ParameterWrapper::deSerialize(const uint8_t** buffer,
|
|||||||
return copyFrom(&streamDescription, startWritingAtIndex);
|
return copyFrom(&streamDescription, startWritingAtIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ParameterWrapper::set(const uint8_t* stream, int32_t streamSize,
|
ReturnValue_t ParameterWrapper::set(const uint8_t* stream, ssize_t streamSize,
|
||||||
const uint8_t **remainingStream, int32_t *remainingSize) {
|
const uint8_t **remainingStream, ssize_t *remainingSize) {
|
||||||
ReturnValue_t result = SerializeAdapter<Type>::deSerialize(&type, &stream,
|
ReturnValue_t result = SerializeAdapter<Type>::deSerialize(&type, &stream,
|
||||||
&streamSize, true);
|
&streamSize, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
@ -30,10 +30,10 @@ public:
|
|||||||
|
|
||||||
virtual size_t getSerializedSize() const;
|
virtual size_t getSerializedSize() const;
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian);
|
bool bigEndian);
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian, uint16_t startWritingAtIndex = 0);
|
bool bigEndian, uint16_t startWritingAtIndex = 0);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -111,8 +111,8 @@ public:
|
|||||||
void setMatrix(const T& member) {
|
void setMatrix(const T& member) {
|
||||||
this->set(member[0], sizeof(member)/sizeof(member[0]), sizeof(member[0])/sizeof(member[0][0]));
|
this->set(member[0], sizeof(member)/sizeof(member[0]), sizeof(member[0])/sizeof(member[0][0]));
|
||||||
}
|
}
|
||||||
ReturnValue_t set(const uint8_t *stream, int32_t streamSize,
|
ReturnValue_t set(const uint8_t *stream, ssize_t streamSize,
|
||||||
const uint8_t **remainingStream = NULL, int32_t *remainingSize =
|
const uint8_t **remainingStream = NULL, ssize_t *remainingSize =
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
ReturnValue_t copyFrom(const ParameterWrapper *from,
|
ReturnValue_t copyFrom(const ParameterWrapper *from,
|
||||||
|
@ -108,7 +108,7 @@ uint32_t Fuse::getSerializedSize() const {
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Fuse::deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t Fuse::deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
ReturnValue_t result = RETURN_FAILED;
|
ReturnValue_t result = RETURN_FAILED;
|
||||||
for (DeviceList::iterator iter = devices.begin(); iter != devices.end();
|
for (DeviceList::iterator iter = devices.begin(); iter != devices.end();
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
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;
|
const size_t max_size, bool bigEndian) const;
|
||||||
uint32_t getSerializedSize() const;
|
uint32_t getSerializedSize() const;
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian);
|
bool bigEndian);
|
||||||
void setAllMonitorsToUnchecked();
|
void setAllMonitorsToUnchecked();
|
||||||
ReturnValue_t performOperation(uint8_t opCode);
|
ReturnValue_t performOperation(uint8_t opCode);
|
||||||
|
@ -56,7 +56,7 @@ float PowerComponent::getMax() {
|
|||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PowerComponent::deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t PowerComponent::deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
ReturnValue_t result = SerializeAdapter<float>::deSerialize(&min, buffer,
|
ReturnValue_t result = SerializeAdapter<float>::deSerialize(&min, buffer,
|
||||||
size, bigEndian);
|
size, bigEndian);
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
|
|
||||||
size_t getSerializedSize() const;
|
size_t getSerializedSize() const;
|
||||||
|
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian);
|
bool bigEndian);
|
||||||
|
|
||||||
ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
|
ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
|
||||||
|
@ -56,13 +56,13 @@ public:
|
|||||||
return printSize;
|
return printSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
return deSerialize(adaptee, buffer, size, bigEndian);
|
return deSerialize(adaptee, buffer, size, bigEndian);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ReturnValue_t deSerialize(ArrayList<T, count_t>* list, const uint8_t** buffer, int32_t* size,
|
static ReturnValue_t deSerialize(ArrayList<T, count_t>* list,
|
||||||
bool bigEndian) {
|
const uint8_t** buffer, ssize_t* size, bool bigEndian) {
|
||||||
count_t tempSize = 0;
|
count_t tempSize = 0;
|
||||||
ReturnValue_t result = SerializeAdapter<count_t>::deSerialize(&tempSize,
|
ReturnValue_t result = SerializeAdapter<count_t>::deSerialize(&tempSize,
|
||||||
buffer, size, bigEndian);
|
buffer, size, bigEndian);
|
||||||
|
@ -63,7 +63,7 @@ size_t SerialBufferAdapter<count_t>::getSerializedSize() const {
|
|||||||
}
|
}
|
||||||
template<typename count_t>
|
template<typename count_t>
|
||||||
ReturnValue_t SerialBufferAdapter<count_t>::deSerialize(const uint8_t** buffer,
|
ReturnValue_t SerialBufferAdapter<count_t>::deSerialize(const uint8_t** buffer,
|
||||||
int32_t* size, bool bigEndian) {
|
ssize_t* size, bool bigEndian) {
|
||||||
//TODO Ignores Endian flag!
|
//TODO Ignores Endian flag!
|
||||||
if (buffer != NULL) {
|
if (buffer != NULL) {
|
||||||
if(m_serialize_length){
|
if(m_serialize_length){
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
|
|
||||||
virtual size_t getSerializedSize() const;
|
virtual size_t getSerializedSize() const;
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian);
|
bool bigEndian);
|
||||||
|
|
||||||
uint8_t * getBuffer();
|
uint8_t * getBuffer();
|
||||||
|
@ -40,9 +40,10 @@ public:
|
|||||||
size_t getSerializedSize() const {
|
size_t getSerializedSize() const {
|
||||||
return SerialArrayListAdapter<BUFFER_TYPE, count_t>::getSerializedSize(this);
|
return SerialArrayListAdapter<BUFFER_TYPE, count_t>::getSerializedSize(this);
|
||||||
}
|
}
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
return SerialArrayListAdapter<BUFFER_TYPE, count_t>::deSerialize(this, buffer, size, bigEndian);
|
return SerialArrayListAdapter<BUFFER_TYPE, count_t>::deSerialize(this,
|
||||||
|
buffer, size, bigEndian);
|
||||||
}
|
}
|
||||||
|
|
||||||
void swapArrayListEndianness() {
|
void swapArrayListEndianness() {
|
||||||
|
@ -112,13 +112,13 @@ public:
|
|||||||
* @param bigEndian Specify endianness
|
* @param bigEndian Specify endianness
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
return deSerialize(SinglyLinkedList<T>::start, buffer, size, bigEndian);
|
return deSerialize(SinglyLinkedList<T>::start, buffer, size, bigEndian);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ReturnValue_t deSerialize(LinkedElement<T>* element,
|
static ReturnValue_t deSerialize(LinkedElement<T>* element,
|
||||||
const uint8_t** buffer, int32_t* size, bool bigEndian) {
|
const uint8_t** buffer, ssize_t* size, bool bigEndian) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
while ((result == HasReturnvaluesIF::RETURN_OK) && (element != NULL)) {
|
while ((result == HasReturnvaluesIF::RETURN_OK) && (element != NULL)) {
|
||||||
result = element->value->deSerialize(buffer, size, bigEndian);
|
result = element->value->deSerialize(buffer, size, bigEndian);
|
||||||
|
@ -88,7 +88,7 @@ public:
|
|||||||
* @param bigEndian Specify endianness
|
* @param bigEndian Specify endianness
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t deSerialize(T* object, const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(T* object, const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
T tmp;
|
T tmp;
|
||||||
*size -= sizeof(T);
|
*size -= sizeof(T);
|
||||||
@ -127,7 +127,7 @@ public:
|
|||||||
return object->getSerializedSize();
|
return object->getSerializedSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t deSerialize(T* object, const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(T* object, const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
return object->deSerialize(buffer, size, bigEndian);
|
return object->deSerialize(buffer, size, bigEndian);
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ReturnValue_t deSerialize(T* object, const uint8_t** buffer,
|
static ReturnValue_t deSerialize(T* object, const uint8_t** buffer,
|
||||||
int32_t* size, bool bigEndian) {
|
ssize_t* size, bool bigEndian) {
|
||||||
SerializeAdapter_<T, IsDerivedFrom<T, SerializeIF>::Is> adapter;
|
SerializeAdapter_<T, IsDerivedFrom<T, SerializeIF>::Is> adapter;
|
||||||
return adapter.deSerialize(object, buffer, size, bigEndian);
|
return adapter.deSerialize(object, buffer, size, bigEndian);
|
||||||
}
|
}
|
||||||
@ -169,7 +169,7 @@ public:
|
|||||||
}
|
}
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static ReturnValue_t deSerialize(T* object, const uint8_t** buffer,
|
static ReturnValue_t deSerialize(T* object, const uint8_t** buffer,
|
||||||
int32_t* size, bool bigEndian) {
|
ssize_t* size, bool bigEndian) {
|
||||||
SerializeAdapter_<T, IsDerivedFrom<T, SerializeIF>::Is> adapter;
|
SerializeAdapter_<T, IsDerivedFrom<T, SerializeIF>::Is> adapter;
|
||||||
return adapter.deSerialize(object, buffer, size, bigEndian);
|
return adapter.deSerialize(object, buffer, size, bigEndian);
|
||||||
}
|
}
|
||||||
|
@ -41,10 +41,11 @@ public:
|
|||||||
return SerializeAdapter<T>::getSerializedSize(&entry);
|
return SerializeAdapter<T>::getSerializedSize(&entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
return SerializeAdapter<T>::deSerialize(&entry, buffer, size, bigEndian);
|
return SerializeAdapter<T>::deSerialize(&entry, buffer, size, bigEndian);
|
||||||
}
|
}
|
||||||
|
|
||||||
operator T() {
|
operator T() {
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
typedef std::make_signed<std::size_t>::type ssize_t;
|
||||||
/**
|
/**
|
||||||
* @defgroup serialize Serialization
|
* @defgroup serialize Serialization
|
||||||
* Contains serialisation services.
|
* Contains serialisation services.
|
||||||
@ -42,7 +44,7 @@ public:
|
|||||||
|
|
||||||
virtual size_t getSerializedSize() const = 0;
|
virtual size_t getSerializedSize() const = 0;
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) = 0;
|
bool bigEndian) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -168,7 +168,7 @@ ReturnValue_t Subsystem::handleCommandMessage(CommandMessage* message) {
|
|||||||
&sizeRead);
|
&sizeRead);
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
Mode_t fallbackId;
|
Mode_t fallbackId;
|
||||||
int32_t size = sizeRead;
|
ssize_t size = sizeRead;
|
||||||
result = SerializeAdapter<Mode_t>::deSerialize(&fallbackId,
|
result = SerializeAdapter<Mode_t>::deSerialize(&fallbackId,
|
||||||
&pointer, &size, true);
|
&pointer, &size, true);
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
@ -193,7 +193,7 @@ ReturnValue_t Subsystem::handleCommandMessage(CommandMessage* message) {
|
|||||||
ModeSequenceMessage::getStoreAddress(message), &pointer,
|
ModeSequenceMessage::getStoreAddress(message), &pointer,
|
||||||
&sizeRead);
|
&sizeRead);
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
int32_t size = sizeRead;
|
ssize_t size = sizeRead;
|
||||||
result = SerialArrayListAdapter<ModeListEntry>::deSerialize(&table,
|
result = SerialArrayListAdapter<ModeListEntry>::deSerialize(&table,
|
||||||
&pointer, &size, true);
|
&pointer, &size, true);
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
|
@ -53,7 +53,7 @@ public:
|
|||||||
return sizeof(value1) + sizeof(value2) + sizeof(value3) + sizeof(value4);
|
return sizeof(value1) + sizeof(value2) + sizeof(value3) + sizeof(value4);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
virtual ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
|
|
||||||
|
@ -40,11 +40,11 @@ ReturnValue_t ThermalComponent::setTargetState(int8_t newState) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ThermalComponent::setLimits(const uint8_t* data, uint32_t size) {
|
ReturnValue_t ThermalComponent::setLimits(const uint8_t* data, ssize_t size) {
|
||||||
if (size != 4 * sizeof(parameters.lowerOpLimit)) {
|
if (size != 4 * sizeof(parameters.lowerOpLimit)) {
|
||||||
return MonitoringIF::INVALID_SIZE;
|
return MonitoringIF::INVALID_SIZE;
|
||||||
}
|
}
|
||||||
int32_t readSize = size;
|
ssize_t readSize = size;
|
||||||
SerializeAdapter<float>::deSerialize(&nopParameters.lowerNopLimit, &data,
|
SerializeAdapter<float>::deSerialize(&nopParameters.lowerNopLimit, &data,
|
||||||
&readSize, true);
|
&readSize, true);
|
||||||
SerializeAdapter<float>::deSerialize(¶meters.lowerOpLimit, &data,
|
SerializeAdapter<float>::deSerialize(¶meters.lowerOpLimit, &data,
|
||||||
|
@ -53,7 +53,7 @@ public:
|
|||||||
|
|
||||||
ReturnValue_t setTargetState(int8_t newState);
|
ReturnValue_t setTargetState(int8_t newState);
|
||||||
|
|
||||||
virtual ReturnValue_t setLimits( const uint8_t* data, uint32_t size);
|
virtual ReturnValue_t setLimits( const uint8_t* data, ssize_t size);
|
||||||
|
|
||||||
virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
|
virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
|
||||||
ParameterWrapper *parameterWrapper,
|
ParameterWrapper *parameterWrapper,
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
return sizeof(apid) + sizeof(ssc);
|
return sizeof(apid) + sizeof(ssc);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
ReturnValue_t result = SerializeAdapter<uint16_t>::deSerialize(&apid,
|
ReturnValue_t result = SerializeAdapter<uint16_t>::deSerialize(&apid,
|
||||||
buffer, size, bigEndian);
|
buffer, size, bigEndian);
|
||||||
@ -257,7 +257,7 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
ReturnValue_t result = AutoSerializeAdapter::deSerialize(&apid, buffer,
|
ReturnValue_t result = AutoSerializeAdapter::deSerialize(&apid, buffer,
|
||||||
size, bigEndian);
|
size, bigEndian);
|
||||||
|
@ -30,7 +30,7 @@ public:
|
|||||||
size_t getSerializedSize() const {
|
size_t getSerializedSize() const {
|
||||||
return SerializeAdapter<uint16_t>::getSerializedSize(&apid);
|
return SerializeAdapter<uint16_t>::getSerializedSize(&apid);
|
||||||
}
|
}
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
return SerializeAdapter<uint16_t>::deSerialize(&apid, buffer, size, bigEndian);
|
return SerializeAdapter<uint16_t>::deSerialize(&apid, buffer, size, bigEndian);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public:
|
|||||||
size_t getSerializedSize() const {
|
size_t getSerializedSize() const {
|
||||||
return SerializeAdapter<uint8_t>::getSerializedSize(&service);
|
return SerializeAdapter<uint8_t>::getSerializedSize(&service);
|
||||||
}
|
}
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
return SerializeAdapter<uint8_t>::deSerialize(&service, buffer, size, bigEndian);
|
return SerializeAdapter<uint8_t>::deSerialize(&service, buffer, size, bigEndian);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public:
|
|||||||
size_t getSerializedSize() const {
|
size_t getSerializedSize() const {
|
||||||
return SerializeAdapter<uint8_t>::getSerializedSize(&subService);
|
return SerializeAdapter<uint8_t>::getSerializedSize(&subService);
|
||||||
}
|
}
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, ssize_t* size,
|
||||||
bool bigEndian) {
|
bool bigEndian) {
|
||||||
return SerializeAdapter<uint8_t>::deSerialize(&subService, buffer, size, bigEndian);
|
return SerializeAdapter<uint8_t>::deSerialize(&subService, buffer, size, bigEndian);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user