Merge branch 'mueller_framework' into front_branch
This commit is contained in:
commit
a926312b25
@ -250,25 +250,6 @@ protected:
|
|||||||
* true if the array was allocated and needs to be deleted in the destructor.
|
* true if the array was allocated and needs to be deleted in the destructor.
|
||||||
*/
|
*/
|
||||||
bool allocated;
|
bool allocated;
|
||||||
|
|
||||||
/**
|
|
||||||
* Swap the endianness of the Array list (not the length field !)
|
|
||||||
* Useful if the case the buffer type is larger than uint8_t
|
|
||||||
* @param list
|
|
||||||
*/
|
|
||||||
void swapArrayListEndianness() {
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
|
||||||
count_t i = 0;
|
|
||||||
// uint8_t buffer does not require swapping of entries.
|
|
||||||
if(sizeof(T) == 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
while ((result == HasReturnvaluesIF::RETURN_OK) && (i < size)) {
|
|
||||||
T newEntry = EndianSwapper::swap(entries[i]);
|
|
||||||
entries[i] = newEntry;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* ARRAYLIST_H_ */
|
#endif /* ARRAYLIST_H_ */
|
||||||
|
@ -20,7 +20,8 @@ public:
|
|||||||
ArrayList<T, count_t>(data, MAX_SIZE) {
|
ArrayList<T, count_t>(data, MAX_SIZE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// (Robin): We could create a constructor to initialize the fixed array list with data and the known size field
|
// (Robin): We could create a constructor to initialize the fixed array list
|
||||||
|
// with data and the known size field
|
||||||
// so it can be used for serialization too (with SerialFixedArrrayListAdapter)
|
// so it can be used for serialization too (with SerialFixedArrrayListAdapter)
|
||||||
// is this feasible?
|
// is this feasible?
|
||||||
/**
|
/**
|
||||||
@ -30,14 +31,10 @@ public:
|
|||||||
* @param count
|
* @param count
|
||||||
* @param swapArrayListEndianess
|
* @param swapArrayListEndianess
|
||||||
*/
|
*/
|
||||||
FixedArrayList(T * data_, count_t count,
|
FixedArrayList(T * data_, count_t count):
|
||||||
bool swapArrayListEndianess = false):
|
|
||||||
ArrayList<T, count_t>(data, MAX_SIZE) {
|
ArrayList<T, count_t>(data, MAX_SIZE) {
|
||||||
memcpy(this->data, data_, count * sizeof(T));
|
memcpy(this->data, data_, count * sizeof(T));
|
||||||
this->size = count;
|
this->size = count;
|
||||||
if(swapArrayListEndianess) {
|
|
||||||
ArrayList<T, count_t>::swapArrayListEndianness();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FixedArrayList(const FixedArrayList& other) :
|
FixedArrayList(const FixedArrayList& other) :
|
||||||
|
Loading…
Reference in New Issue
Block a user