replaced serializeIF serialize sizes with size_t

This commit is contained in:
Robin Müller 2020-04-05 17:58:39 +02:00
parent 06ae64d59c
commit 7079c9c56d
48 changed files with 118 additions and 109 deletions

View File

@ -67,7 +67,8 @@ void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t act
} }
} }
ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t replyId, SerializeIF* data, bool hideSender) { ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo,
ActionId_t replyId, SerializeIF* data, bool hideSender) {
CommandMessage reply; CommandMessage reply;
store_address_t storeAddress; store_address_t storeAddress;
uint8_t *dataPtr; uint8_t *dataPtr;
@ -76,7 +77,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
//No error, there's simply nothing to report. //No error, there's simply nothing to report.
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
uint32_t size = 0; size_t size = 0;
ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize, ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize,
&dataPtr); &dataPtr);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {

View File

@ -26,7 +26,7 @@ ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo,
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
uint32_t size = 0; size_t size = 0;
result = data->serialize(&storePointer, &size, maxSize, true); result = data->serialize(&storePointer, &size, maxSize, true);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;

View File

@ -173,8 +173,8 @@ public:
} }
} }
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
ReturnValue_t result = SerializeAdapter<uint32_t>::serialize(&this->_size, ReturnValue_t result = SerializeAdapter<uint32_t>::serialize(&this->_size,
buffer, size, max_size, bigEndian); buffer, size, max_size, bigEndian);
uint32_t i = 0; uint32_t i = 0;

View File

@ -272,7 +272,7 @@ ReturnValue_t DataPoolAdmin::sendParameter(MessageQueueId_t to, uint32_t id,
return result; return result;
} }
uint32_t storeElementSize = 0; size_t storeElementSize = 0;
result = wrapper->serialize(&storeElement, &storeElementSize, result = wrapper->serialize(&storeElement, &storeElementSize,
serializedSize, true); serializedSize, true);

View File

@ -36,7 +36,7 @@ ReturnValue_t DataPoolParameterWrapper::set(uint8_t domainId,
} }
ReturnValue_t DataPoolParameterWrapper::serialize(uint8_t** buffer, ReturnValue_t DataPoolParameterWrapper::serialize(uint8_t** buffer,
uint32_t* size, const uint32_t max_size, bool bigEndian) const { size_t* size, const size_t max_size, bool bigEndian) const {
ReturnValue_t result; ReturnValue_t result;
result = SerializeAdapter<Type>::serialize(&type, buffer, size, max_size, result = SerializeAdapter<Type>::serialize(&type, buffer, size, max_size,

View File

@ -11,8 +11,8 @@ public:
ReturnValue_t set(uint8_t domainId, uint16_t parameterId); ReturnValue_t set(uint8_t domainId, uint16_t parameterId);
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const; const size_t max_size, bool bigEndian) const;
virtual uint32_t getSerializedSize() const; virtual uint32_t getSerializedSize() const;

View File

@ -106,8 +106,8 @@ uint8_t DataSet::lockDataPool() {
return ::dataPool.lockDataPool(); return ::dataPool.lockDataPool();
} }
ReturnValue_t DataSet::serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t DataSet::serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
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++) {
result = registeredVariables[count]->serialize(buffer, size, max_size, result = registeredVariables[count]->serialize(buffer, size, max_size,

View File

@ -121,8 +121,8 @@ public:
* @param bigEndian * @param bigEndian
* @return * @return
*/ */
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const; const size_t max_size, bool bigEndian) const;
uint32_t getSerializedSize() const; uint32_t getSerializedSize() const;

View File

@ -126,8 +126,8 @@ public:
return *this; return *this;
} }
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
return SerializeAdapter<T>::serialize(&value, buffer, size, max_size, return SerializeAdapter<T>::serialize(&value, buffer, size, max_size,
bigEndian); bigEndian);
} }

View File

@ -111,8 +111,8 @@ ReturnValue_t PoolRawAccess::getEntryEndianSafe(uint8_t* buffer,
} }
ReturnValue_t PoolRawAccess::serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t PoolRawAccess::serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
if (typeSize + *size <= max_size) { if (typeSize + *size <= max_size) {
if (bigEndian) { if (bigEndian) {
#ifndef BYTE_ORDER_SYSTEM #ifndef BYTE_ORDER_SYSTEM

View File

@ -81,8 +81,8 @@ 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, uint32_t* size, ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const; const size_t max_size, bool bigEndian) const;
/** /**
* 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.

View File

@ -14,14 +14,15 @@
PoolRawAccessHelper::PoolRawAccessHelper(uint32_t * poolIdBuffer_, PoolRawAccessHelper::PoolRawAccessHelper(uint32_t * poolIdBuffer_,
uint8_t numberOfParameters_): uint8_t numberOfParameters_):
poolIdBuffer(reinterpret_cast<uint8_t * >(poolIdBuffer_)), poolIdBuffer(reinterpret_cast<uint8_t * >(poolIdBuffer_)),
numberOfParameters(numberOfParameters_), validBufferIndex(0), validBufferIndexBit(1){ numberOfParameters(numberOfParameters_), validBufferIndex(0),
validBufferIndexBit(1) {
} }
PoolRawAccessHelper::~PoolRawAccessHelper() { PoolRawAccessHelper::~PoolRawAccessHelper() {
} }
ReturnValue_t PoolRawAccessHelper::serialize(uint8_t **buffer, uint32_t *size, ReturnValue_t PoolRawAccessHelper::serialize(uint8_t **buffer, size_t *size,
const uint32_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; int32_t remainingParametersSize = numberOfParameters * 4;
@ -39,8 +40,8 @@ ReturnValue_t PoolRawAccessHelper::serialize(uint8_t **buffer, uint32_t *size,
return result; return result;
} }
ReturnValue_t PoolRawAccessHelper::serializeWithValidityMask(uint8_t ** buffer, uint32_t * size, ReturnValue_t PoolRawAccessHelper::serializeWithValidityMask(uint8_t ** buffer,
const uint32_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; int32_t remainingParametersSize = numberOfParameters * 4;

View File

@ -41,8 +41,8 @@ public:
* @return @c RETURN_OK On success * @return @c RETURN_OK On success
* @c RETURN_FAILED on failure * @c RETURN_FAILED on failure
*/ */
ReturnValue_t serialize(uint8_t ** buffer, uint32_t * size, ReturnValue_t serialize(uint8_t ** buffer, size_t * size,
const uint32_t max_size, bool bigEndian); const size_t max_size, bool bigEndian);
/** /**
* Serializes data pool entries into provided buffer with the validity mask buffer * Serializes data pool entries into provided buffer with the validity mask buffer
@ -54,8 +54,8 @@ public:
* @return @c RETURN_OK On success * @return @c RETURN_OK On success
* @c RETURN_FAILED on failure * @c RETURN_FAILED on failure
*/ */
ReturnValue_t serializeWithValidityMask(uint8_t ** buffer, uint32_t * size, ReturnValue_t serializeWithValidityMask(uint8_t ** buffer, size_t * size,
const uint32_t max_size, bool bigEndian); const size_t max_size, bool bigEndian);
private: private:
@ -68,7 +68,7 @@ private:
struct SerializationArgs { struct SerializationArgs {
uint8_t ** buffer; uint8_t ** buffer;
uint32_t * size; size_t * size;
const uint32_t max_size; const uint32_t max_size;
bool bigEndian; bool bigEndian;
}; };

View File

@ -193,8 +193,8 @@ public:
return *this; return *this;
} }
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
return SerializeAdapter<T>::serialize(&value, buffer, size, max_size, return SerializeAdapter<T>::serialize(&value, buffer, size, max_size,
bigEndian); bigEndian);
} }

View File

@ -197,8 +197,8 @@ public:
return *this; return *this;
} }
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
uint16_t i; uint16_t i;
ReturnValue_t result; ReturnValue_t result;
for (i = 0; i < vector_size; i++) { for (i = 0; i < vector_size; i++) {

View File

@ -12,7 +12,7 @@ DeviceTmReportingWrapper::~DeviceTmReportingWrapper() {
} }
ReturnValue_t DeviceTmReportingWrapper::serialize(uint8_t** buffer, ReturnValue_t DeviceTmReportingWrapper::serialize(uint8_t** buffer,
uint32_t* size, const uint32_t max_size, bool bigEndian) const { size_t* size, const size_t max_size, bool bigEndian) const {
ReturnValue_t result = SerializeAdapter<object_id_t>::serialize(&objectId, ReturnValue_t result = SerializeAdapter<object_id_t>::serialize(&objectId,
buffer, size, max_size, bigEndian); buffer, size, max_size, bigEndian);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {

View File

@ -11,8 +11,8 @@ public:
SerializeIF *data); SerializeIF *data);
virtual ~DeviceTmReportingWrapper(); virtual ~DeviceTmReportingWrapper();
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const; const size_t max_size, bool bigEndian) const;
virtual uint32_t getSerializedSize() const; virtual uint32_t getSerializedSize() const;

View File

@ -11,8 +11,8 @@ class EventRangeMatcherBase: public SerializeableMatcherIF<EventMessage*> {
public: public:
EventRangeMatcherBase(T from, T till, bool inverted) : rangeMatcher(from, till, inverted) { } EventRangeMatcherBase(T from, T till, bool inverted) : rangeMatcher(from, till, inverted) { }
virtual ~EventRangeMatcherBase() { } virtual ~EventRangeMatcherBase() { }
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
return rangeMatcher.serialize(buffer, size, max_size, bigEndian); return rangeMatcher.serialize(buffer, size, max_size, bigEndian);
} }
uint32_t getSerializedSize() const { uint32_t getSerializedSize() const {

View File

@ -59,8 +59,8 @@ uint8_t Type::getSize() const {
} }
} }
ReturnValue_t Type::serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t Type::serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
uint8_t ptc; uint8_t ptc;
uint8_t pfc; uint8_t pfc;
ReturnValue_t result = getPtcPfc(&ptc, &pfc); ReturnValue_t result = getPtcPfc(&ptc, &pfc);

View File

@ -39,8 +39,8 @@ public:
static ActualType_t getActualType(uint8_t ptc, uint8_t pfc); static ActualType_t getActualType(uint8_t ptc, uint8_t pfc);
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const; const size_t max_size, bool bigEndian) const;
virtual uint32_t getSerializedSize() const; virtual uint32_t getSerializedSize() const;

View File

@ -45,8 +45,8 @@ public:
return matchSubtree(iter, number); return matchSubtree(iter, number);
} }
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
iterator iter = this->begin(); iterator iter = this->begin();
uint8_t count = this->countRight(iter); uint8_t count = this->countRight(iter);
ReturnValue_t result = SerializeAdapter<uint8_t>::serialize(&count, ReturnValue_t result = SerializeAdapter<uint8_t>::serialize(&count,

View File

@ -27,8 +27,8 @@ public:
} }
} }
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
ReturnValue_t result = SerializeAdapter<T>::serialize(&lowerBound, buffer, size, max_size, bigEndian); ReturnValue_t result = SerializeAdapter<T>::serialize(&lowerBound, buffer, size, max_size, bigEndian);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;

View File

@ -65,7 +65,7 @@ bool HealthTable::hasHealth(object_id_t object) {
void HealthTable::printAll(uint8_t* pointer, uint32_t maxSize) { void HealthTable::printAll(uint8_t* pointer, uint32_t maxSize) {
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::NO_TIMEOUT);
uint32_t size = 0; size_t size = 0;
uint16_t count = healthMap.size(); uint16_t count = healthMap.size();
ReturnValue_t result = SerializeAdapter<uint16_t>::serialize(&count, ReturnValue_t result = SerializeAdapter<uint16_t>::serialize(&count,
&pointer, &size, maxSize, true); &pointer, &size, maxSize, true);

View File

@ -26,7 +26,7 @@ ReturnValue_t LimitViolationReporter::sendLimitViolationReport(const SerializeIF
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
uint32_t size = 0; size_t size = 0;
result = data->serialize(&dataTarget, &size, maxSize, true); result = data->serialize(&dataTarget, &size, maxSize, true);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;

View File

@ -94,7 +94,7 @@ ReturnValue_t ParameterHelper::sendParameter(MessageQueueId_t to, uint32_t id,
return result; return result;
} }
uint32_t storeElementSize = 0; size_t storeElementSize = 0;
result = description->serialize(&storeElement, &storeElementSize, result = description->serialize(&storeElement, &storeElementSize,
serializedSize, true); serializedSize, true);

View File

@ -20,8 +20,8 @@ ParameterWrapper::ParameterWrapper(Type type, uint8_t rows, uint8_t columns,
ParameterWrapper::~ParameterWrapper() { ParameterWrapper::~ParameterWrapper() {
} }
ReturnValue_t ParameterWrapper::serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t ParameterWrapper::serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
ReturnValue_t result; ReturnValue_t result;
result = SerializeAdapter<Type>::serialize(&type, buffer, size, max_size, result = SerializeAdapter<Type>::serialize(&type, buffer, size, max_size,
@ -88,8 +88,8 @@ uint32_t ParameterWrapper::getSerializedSize() const {
} }
template<typename T> template<typename T>
ReturnValue_t ParameterWrapper::serializeData(uint8_t** buffer, uint32_t* size, ReturnValue_t ParameterWrapper::serializeData(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
const T *element = (const T*) readonlyData; const T *element = (const T*) readonlyData;
ReturnValue_t result; ReturnValue_t result;
uint16_t dataSize = columns * rows; uint16_t dataSize = columns * rows;

View File

@ -25,8 +25,8 @@ public:
const void *data); const void *data);
virtual ~ParameterWrapper(); virtual ~ParameterWrapper();
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const; const size_t max_size, bool bigEndian) const;
virtual uint32_t getSerializedSize() const; virtual uint32_t getSerializedSize() const;
@ -128,8 +128,8 @@ private:
const void *readonlyData; const void *readonlyData;
template<typename T> template<typename T>
ReturnValue_t serializeData(uint8_t** buffer, uint32_t* size, ReturnValue_t serializeData(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const; const size_t max_size, bool bigEndian) const;
template<typename T> template<typename T>
ReturnValue_t deSerializeData(uint8_t startingRow, uint8_t startingColumn, ReturnValue_t deSerializeData(uint8_t startingRow, uint8_t startingColumn,

View File

@ -86,8 +86,8 @@ ReturnValue_t Fuse::check() {
return result; return result;
} }
ReturnValue_t Fuse::serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t Fuse::serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
ReturnValue_t result = RETURN_FAILED; ReturnValue_t result = RETURN_FAILED;
for (DeviceList::const_iterator iter = devices.begin(); for (DeviceList::const_iterator iter = devices.begin();
iter != devices.end(); iter++) { iter != devices.end(); iter++) {

View File

@ -49,8 +49,8 @@ public:
uint8_t getFuseId() const; uint8_t getFuseId() const;
ReturnValue_t initialize(); ReturnValue_t initialize();
DeviceList devices; DeviceList devices;
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_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, int32_t* size,
bool bigEndian); bool bigEndian);

View File

@ -17,8 +17,8 @@ PowerComponent::PowerComponent(object_id_t setId, uint8_t moduleId, float min, f
twoSwitches), min(min), max(max), moduleId(moduleId) { twoSwitches), min(min), max(max), moduleId(moduleId) {
} }
ReturnValue_t PowerComponent::serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t PowerComponent::serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
ReturnValue_t result = SerializeAdapter<float>::serialize(&min, buffer, ReturnValue_t result = SerializeAdapter<float>::serialize(&min, buffer,
size, max_size, bigEndian); size, max_size, bigEndian);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {

View File

@ -19,8 +19,8 @@ public:
float getMin(); float getMin();
float getMax(); float getMax();
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const; const size_t max_size, bool bigEndian) const;
uint32_t getSerializedSize() const; uint32_t getSerializedSize() const;

View File

@ -21,13 +21,14 @@ public:
SerialArrayListAdapter(ArrayList<T, count_t> *adaptee) : adaptee(adaptee) { SerialArrayListAdapter(ArrayList<T, count_t> *adaptee) : adaptee(adaptee) {
} }
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
return serialize(adaptee, buffer, size, max_size, bigEndian); return serialize(adaptee, buffer, size, max_size, bigEndian);
} }
static ReturnValue_t serialize(const ArrayList<T, count_t>* list, uint8_t** buffer, uint32_t* size, static ReturnValue_t serialize(const ArrayList<T, count_t>* list,
const uint32_t max_size, bool bigEndian) { uint8_t** buffer, size_t* size, const size_t max_size,
bool bigEndian) {
// Serialize length field first // Serialize length field first
ReturnValue_t result = SerializeAdapter<count_t>::serialize(&list->size, ReturnValue_t result = SerializeAdapter<count_t>::serialize(&list->size,
buffer, size, max_size, bigEndian); buffer, size, max_size, bigEndian);

View File

@ -26,8 +26,8 @@ SerialBufferAdapter<count_t>::~SerialBufferAdapter() {
} }
template<typename count_t> template<typename count_t>
ReturnValue_t SerialBufferAdapter<count_t>::serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t SerialBufferAdapter<count_t>::serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
uint32_t serializedLength = m_buffer_length; uint32_t serializedLength = m_buffer_length;
if (m_serialize_length) { if (m_serialize_length) {
serializedLength += AutoSerializeAdapter::getSerializedSize( serializedLength += AutoSerializeAdapter::getSerializedSize(

View File

@ -40,8 +40,8 @@ public:
virtual ~SerialBufferAdapter(); virtual ~SerialBufferAdapter();
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const; const size_t max_size, bool bigEndian) const;
virtual uint32_t getSerializedSize() const; virtual uint32_t getSerializedSize() const;

View File

@ -32,8 +32,8 @@ public:
SerialFixedArrayListAdapter(Args... args) : FixedArrayList<BUFFER_TYPE, MAX_SIZE, count_t>(std::forward<Args>(args)...) { SerialFixedArrayListAdapter(Args... args) : FixedArrayList<BUFFER_TYPE, MAX_SIZE, count_t>(std::forward<Args>(args)...) {
} }
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
return SerialArrayListAdapter<BUFFER_TYPE, count_t>::serialize(this, buffer, size, max_size, bigEndian); return SerialArrayListAdapter<BUFFER_TYPE, count_t>::serialize(this, buffer, size, max_size, bigEndian);
} }

View File

@ -63,8 +63,8 @@ public:
* @param bigEndian Specify endianness * @param bigEndian Specify endianness
* @return * @return
*/ */
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
if (printCount) { if (printCount) {
count_t mySize = SinglyLinkedList<T>::getSize(); count_t mySize = SinglyLinkedList<T>::getSize();
ReturnValue_t result = SerializeAdapter<count_t>::serialize(&mySize, ReturnValue_t result = SerializeAdapter<count_t>::serialize(&mySize,
@ -78,7 +78,7 @@ public:
} }
static ReturnValue_t serialize(const LinkedElement<T>* element, static ReturnValue_t serialize(const LinkedElement<T>* element,
uint8_t** buffer, uint32_t* size, const uint32_t max_size, uint8_t** buffer, size_t* size, const size_t max_size,
bool bigEndian) { 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)) {

View File

@ -59,8 +59,8 @@ template<typename T, int>
class SerializeAdapter_ { class SerializeAdapter_ {
public: public:
static ReturnValue_t serialize(const T* object, uint8_t** buffer, static ReturnValue_t serialize(const T* object, uint8_t** buffer,
uint32_t* size, const uint32_t max_size, bool bigEndian) { size_t* size, const size_t max_size, bool bigEndian) {
uint32_t ignoredSize = 0; size_t ignoredSize = 0;
if (size == NULL) { if (size == NULL) {
size = &ignoredSize; size = &ignoredSize;
} }
@ -115,9 +115,9 @@ public:
template<typename T> template<typename T>
class SerializeAdapter_<T, 1> { class SerializeAdapter_<T, 1> {
public: public:
ReturnValue_t serialize(const T* object, uint8_t** buffer, uint32_t* size, ReturnValue_t serialize(const T* object, uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
uint32_t ignoredSize = 0; size_t ignoredSize = 0;
if (size == NULL) { if (size == NULL) {
size = &ignoredSize; size = &ignoredSize;
} }
@ -137,7 +137,7 @@ template<typename T>
class SerializeAdapter { class SerializeAdapter {
public: public:
static ReturnValue_t serialize(const T* object, uint8_t** buffer, static ReturnValue_t serialize(const T* object, uint8_t** buffer,
uint32_t* size, const uint32_t max_size, bool bigEndian) { size_t* size, const size_t max_size, bool bigEndian) {
SerializeAdapter_<T, IsDerivedFrom<T, SerializeIF>::Is> adapter; SerializeAdapter_<T, IsDerivedFrom<T, SerializeIF>::Is> adapter;
return adapter.serialize(object, buffer, size, max_size, bigEndian); return adapter.serialize(object, buffer, size, max_size, bigEndian);
} }
@ -158,7 +158,7 @@ class AutoSerializeAdapter {
public: public:
template<typename T> template<typename T>
static ReturnValue_t serialize(const T* object, uint8_t** buffer, static ReturnValue_t serialize(const T* object, uint8_t** buffer,
uint32_t* size, const uint32_t max_size, bool bigEndian) { size_t* size, const size_t max_size, bool bigEndian) {
SerializeAdapter_<T, IsDerivedFrom<T, SerializeIF>::Is> adapter; SerializeAdapter_<T, IsDerivedFrom<T, SerializeIF>::Is> adapter;
return adapter.serialize(object, buffer, size, max_size, bigEndian); return adapter.serialize(object, buffer, size, max_size, bigEndian);
} }

View File

@ -29,9 +29,11 @@ public:
} }
SerializeElement() : LinkedElement<SerializeIF>(this) { SerializeElement() : LinkedElement<SerializeIF>(this) {
} }
T entry; T entry;
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const { ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const size_t max_size, bool bigEndian) const {
return SerializeAdapter<T>::serialize(&entry, buffer, size, max_size, bigEndian); return SerializeAdapter<T>::serialize(&entry, buffer, size, max_size, bigEndian);
} }

View File

@ -2,6 +2,7 @@
#define SERIALIZEIF_H_ #define SERIALIZEIF_H_
#include <framework/returnvalues/HasReturnvaluesIF.h> #include <framework/returnvalues/HasReturnvaluesIF.h>
#include <cstddef>
/** /**
* @defgroup serialize Serialization * @defgroup serialize Serialization
@ -36,8 +37,8 @@ public:
virtual ~SerializeIF() { virtual ~SerializeIF() {
} }
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const = 0; const size_t max_size, bool bigEndian) const = 0;
virtual uint32_t getSerializedSize() const = 0; virtual uint32_t getSerializedSize() const = 0;

View File

@ -607,7 +607,7 @@ void Subsystem::sendSerializablesAsCommandMessage(Command_t command,
} }
uint8_t *storeBuffer; uint8_t *storeBuffer;
store_address_t address; store_address_t address;
uint32_t size = 0; size_t size = 0;
result = IPCStore->getFreeElement(&address, maxSize, &storeBuffer); result = IPCStore->getFreeElement(&address, maxSize, &storeBuffer);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {

View File

@ -18,8 +18,8 @@ public:
uint8_t value3; uint8_t value3;
uint8_t value4; uint8_t value4;
virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
ReturnValue_t result; ReturnValue_t result;

View File

@ -32,8 +32,8 @@ public:
} }
uint16_t apid; uint16_t apid;
uint16_t ssc; uint16_t ssc;
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
ReturnValue_t result = SerializeAdapter<uint16_t>::serialize(&apid, ReturnValue_t result = SerializeAdapter<uint16_t>::serialize(&apid,
buffer, size, max_size, bigEndian); buffer, size, max_size, bigEndian);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
@ -218,8 +218,8 @@ public:
} }
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
ReturnValue_t result = AutoSerializeAdapter::serialize(&apid,buffer,size,max_size,bigEndian); ReturnValue_t result = AutoSerializeAdapter::serialize(&apid,buffer,size,max_size,bigEndian);
if(result!=HasReturnvaluesIF::RETURN_OK){ if(result!=HasReturnvaluesIF::RETURN_OK){
return result; return result;

View File

@ -22,9 +22,10 @@ public:
return false; return false;
} }
} }
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
return SerializeAdapter<uint16_t>::serialize(&apid, buffer, size, max_size, bigEndian); return SerializeAdapter<uint16_t>::serialize(&apid, buffer,
size, max_size, bigEndian);
} }
uint32_t getSerializedSize() const { uint32_t getSerializedSize() const {
return SerializeAdapter<uint16_t>::getSerializedSize(&apid); return SerializeAdapter<uint16_t>::getSerializedSize(&apid);

View File

@ -22,9 +22,10 @@ public:
return false; return false;
} }
} }
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
return SerializeAdapter<uint8_t>::serialize(&service, buffer, size, max_size, bigEndian); return SerializeAdapter<uint8_t>::serialize(&service, buffer,
size, max_size, bigEndian);
} }
uint32_t getSerializedSize() const { uint32_t getSerializedSize() const {
return SerializeAdapter<uint8_t>::getSerializedSize(&service); return SerializeAdapter<uint8_t>::getSerializedSize(&service);

View File

@ -20,9 +20,10 @@ public:
return false; return false;
} }
} }
ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, ReturnValue_t serialize(uint8_t** buffer, size_t* size,
const uint32_t max_size, bool bigEndian) const { const size_t max_size, bool bigEndian) const {
return SerializeAdapter<uint8_t>::serialize(&subService, buffer, size, max_size, bigEndian); return SerializeAdapter<uint8_t>::serialize(&subService, buffer, size,
max_size, bigEndian);
} }
uint32_t getSerializedSize() const { uint32_t getSerializedSize() const {
return SerializeAdapter<uint8_t>::getSerializedSize(&subService); return SerializeAdapter<uint8_t>::getSerializedSize(&subService);

View File

@ -58,7 +58,7 @@ TmPacketStored::TmPacketStored(uint16_t apid, uint8_t service,
setData(p_data); setData(p_data);
initializeTmPacket(apid, service, subservice, packetSubcounter); initializeTmPacket(apid, service, subservice, packetSubcounter);
uint8_t* putDataHere = getSourceData(); uint8_t* putDataHere = getSourceData();
uint32_t size = 0; size_t size = 0;
if (header != NULL) { if (header != NULL) {
header->serialize(&putDataHere, &size, sourceDataSize, true); header->serialize(&putDataHere, &size, sourceDataSize, true);
} }

View File

@ -235,7 +235,7 @@ void CommandingServiceBase::sendTmPacket(uint8_t subservice,
object_id_t objectId, const uint8_t *data, size_t dataLen) { object_id_t objectId, const uint8_t *data, size_t dataLen) {
uint8_t buffer[sizeof(object_id_t)]; uint8_t buffer[sizeof(object_id_t)];
uint8_t* pBuffer = buffer; uint8_t* pBuffer = buffer;
uint32_t size = 0; size_t size = 0;
SerializeAdapter<object_id_t>::serialize(&objectId, &pBuffer, &size, SerializeAdapter<object_id_t>::serialize(&objectId, &pBuffer, &size,
sizeof(object_id_t), true); sizeof(object_id_t), true);
TmPacketStored tmPacketStored(this->apid, this->service, subservice, TmPacketStored tmPacketStored(this->apid, this->service, subservice,

View File

@ -49,7 +49,7 @@ class PusSuccessReport {
private: private:
static const uint16_t MAX_SIZE = 7; static const uint16_t MAX_SIZE = 7;
uint8_t reportBuffer[MAX_SIZE]; uint8_t reportBuffer[MAX_SIZE];
uint32_t reportSize; size_t reportSize;
uint8_t * pBuffer; uint8_t * pBuffer;
public: public:
PusSuccessReport(uint16_t setPacketId, uint16_t setSequenceControl, PusSuccessReport(uint16_t setPacketId, uint16_t setSequenceControl,
@ -63,7 +63,7 @@ class PusFailureReport {
private: private:
static const uint16_t MAX_SIZE = 16; static const uint16_t MAX_SIZE = 16;
uint8_t reportBuffer[MAX_SIZE]; uint8_t reportBuffer[MAX_SIZE];
uint32_t reportSize; size_t reportSize;
uint8_t * pBuffer; uint8_t * pBuffer;
public: public:
PusFailureReport(uint16_t setPacketId, uint16_t setSequenceControl, PusFailureReport(uint16_t setPacketId, uint16_t setSequenceControl,