seiralize folder converged
This commit is contained in:
parent
1803030640
commit
faeeca8707
@ -1,18 +1,13 @@
|
|||||||
/**
|
#ifndef FSFW_SERIALIZE_SERIALARRAYLISTADAPTER_H_
|
||||||
* @file SerialArrayListAdapter.h
|
#define FSFW_SERIALIZE_SERIALARRAYLISTADAPTER_H_
|
||||||
* @brief This file defines the SerialArrayListAdapter class.
|
|
||||||
* @date 22.07.2014
|
|
||||||
* @author baetz
|
|
||||||
*/
|
|
||||||
#ifndef SERIALARRAYLISTADAPTER_H_
|
|
||||||
#define SERIALARRAYLISTADAPTER_H_
|
|
||||||
|
|
||||||
|
#include "SerializeIF.h"
|
||||||
#include "../container/ArrayList.h"
|
#include "../container/ArrayList.h"
|
||||||
#include "../serialize/SerializeIF.h"
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Also serializes length field !
|
* Also serializes length field !
|
||||||
|
* @author baetz
|
||||||
* @ingroup serialize
|
* @ingroup serialize
|
||||||
*/
|
*/
|
||||||
template<typename T, typename count_t = uint8_t>
|
template<typename T, typename count_t = uint8_t>
|
||||||
@ -26,8 +21,9 @@ public:
|
|||||||
return serialize(adaptee, buffer, size, maxSize, streamEndianness);
|
return serialize(adaptee, buffer, size, maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ReturnValue_t serialize(const ArrayList<T, count_t>* list, uint8_t** buffer, size_t* size,
|
static ReturnValue_t serialize(const ArrayList<T, count_t>* list,
|
||||||
size_t maxSize, Endianness streamEndianness) {
|
uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
|
Endianness streamEndianness) {
|
||||||
ReturnValue_t result = SerializeAdapter::serialize(&list->size,
|
ReturnValue_t result = SerializeAdapter::serialize(&list->size,
|
||||||
buffer, size, maxSize, streamEndianness);
|
buffer, size, maxSize, streamEndianness);
|
||||||
count_t i = 0;
|
count_t i = 0;
|
||||||
@ -59,14 +55,19 @@ public:
|
|||||||
return deSerialize(adaptee, buffer, size, streamEndianness);
|
return deSerialize(adaptee, buffer, size, streamEndianness);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ReturnValue_t deSerialize(ArrayList<T, count_t>* list, const uint8_t** buffer, size_t* size,
|
static ReturnValue_t deSerialize(ArrayList<T, count_t>* list,
|
||||||
|
const uint8_t** buffer, size_t* size,
|
||||||
Endianness streamEndianness) {
|
Endianness streamEndianness) {
|
||||||
count_t tempSize = 0;
|
count_t tempSize = 0;
|
||||||
ReturnValue_t result = SerializeAdapter::deSerialize(&tempSize,
|
ReturnValue_t result = SerializeAdapter::deSerialize(&tempSize,
|
||||||
buffer, size, streamEndianness);
|
buffer, size, streamEndianness);
|
||||||
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
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)) {
|
||||||
@ -78,14 +79,8 @@ public:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void swapArrayListEndianness(ArrayList<T, count_t>* list) {
|
|
||||||
list->swapArrayListEndianness();
|
|
||||||
}
|
|
||||||
private:
|
private:
|
||||||
ArrayList<T, count_t> *adaptee;
|
ArrayList<T, count_t> *adaptee;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif /* FSFW_SERIALIZE_SERIALARRAYLISTADAPTER_H_ */
|
||||||
|
|
||||||
#endif /* SERIALARRAYLISTADAPTER_H_ */
|
|
||||||
|
Loading…
Reference in New Issue
Block a user