took over serial array list adapter changes

This commit is contained in:
Robin Müller 2020-09-04 16:07:11 +02:00
parent 328c1b7195
commit 1a62158f33

View File

@ -1,13 +1,14 @@
#ifndef FRAMEWORK_SERIALIZE_SERIALARRAYLISTADAPTER_H_ #ifndef FSFW_SERIALIZE_SERIALARRAYLISTADAPTER_H_
#define FRAMEWORK_SERIALIZE_SERIALARRAYLISTADAPTER_H_ #define FSFW_SERIALIZE_SERIALARRAYLISTADAPTER_H_
#include "../container/ArrayList.h"
#include "SerializeIF.h" #include "SerializeIF.h"
#include "../container/ArrayList.h"
#include <utility> #include <utility>
/** /**
* @ingroup serialize * Also serializes length field !
* @author baetz * @author baetz
* @ingroup serialize
*/ */
template<typename T, typename count_t = uint8_t> template<typename T, typename count_t = uint8_t>
class SerialArrayListAdapter : public SerializeIF { class SerialArrayListAdapter : public SerializeIF {
@ -27,8 +28,8 @@ public:
buffer, size, maxSize, streamEndianness); buffer, size, maxSize, streamEndianness);
count_t i = 0; count_t i = 0;
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < list->size)) { while ((result == HasReturnvaluesIF::RETURN_OK) && (i < list->size)) {
result = SerializeAdapter::serialize(&list->entries[i], buffer, result = SerializeAdapter::serialize(&list->entries[i], buffer, size,
size, maxSize, streamEndianness); maxSize, streamEndianness);
++i; ++i;
} }
return result; return result;
@ -66,6 +67,7 @@ public:
if (tempSize > list->maxSize()) { if (tempSize > list->maxSize()) {
return SerializeIF::TOO_MANY_ELEMENTS; return SerializeIF::TOO_MANY_ELEMENTS;
} }
list->size = tempSize; list->size = tempSize;
count_t i = 0; count_t i = 0;
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < list->size)) { while ((result == HasReturnvaluesIF::RETURN_OK) && (i < list->size)) {
@ -76,10 +78,9 @@ public:
} }
return result; return result;
} }
private: private:
ArrayList<T, count_t> *adaptee; ArrayList<T, count_t> *adaptee;
}; };
#endif /* FSFW_SERIALIZE_SERIALARRAYLISTADAPTER_H_ */
#endif /* FRAMEWORK_SERIALIZE_SERIALARRAYLISTADAPTER_H_ */