From 1437f33027cf60c8561eb3517418df2b16194016 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 15 Jan 2020 17:30:23 +0100 Subject: [PATCH] Serial Fixed Array List template type clarifications --- serialize/SerialArrayListAdapter.h | 1 + serialize/SerialBufferAdapter.h | 3 ++- serialize/SerialFixedArrayListAdapter.h | 22 +++++++++++++--------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/serialize/SerialArrayListAdapter.h b/serialize/SerialArrayListAdapter.h index 7e2e527bc..72b8d97f6 100644 --- a/serialize/SerialArrayListAdapter.h +++ b/serialize/SerialArrayListAdapter.h @@ -12,6 +12,7 @@ #include /** + * Also serializes length field ! * \ingroup serialize */ template diff --git a/serialize/SerialBufferAdapter.h b/serialize/SerialBufferAdapter.h index 6623beb3b..b7729e316 100644 --- a/serialize/SerialBufferAdapter.h +++ b/serialize/SerialBufferAdapter.h @@ -11,7 +11,8 @@ * Additionally, the buffer length can be serialized too and will be put in front of the serialized buffer. * * Can be used with SerialLinkedListAdapter by declaring a SerializeElement with - * SerialElement> serialBufferElement + * SerialElement> serialBufferElement. + * Right now, the SerialBufferAdapter must always be initialized with the buffer and size ! * * \ingroup serialize */ diff --git a/serialize/SerialFixedArrayListAdapter.h b/serialize/SerialFixedArrayListAdapter.h index c8424f05d..4c4ec56fd 100644 --- a/serialize/SerialFixedArrayListAdapter.h +++ b/serialize/SerialFixedArrayListAdapter.h @@ -8,34 +8,38 @@ * @brief This adapter provides an interface for SerializeIF to serialize and deserialize * buffers with a header containing the buffer length. * @details + * * Can be used by SerialLinkedListAdapter by using this type in * SerializeElement<>. + * * Buffers with a size header inside that class can be declared with - * SerialFixedArrayListAdapter. - * typeOfMaxData specifies the data type of the buffer header containing the buffer size that follows - * and MAX_BUFFER_LENGTH specifies the maximum allowed value for the buffer size. + * SerialFixedArrayListAdapter. + * LENGTH_FIELD_TYPE specifies the data type of the buffer header containing the buffer size + * (defaults to 1 byte length field) that follows and MAX_BUFFER_LENGTH specifies + * the maximum allowed value for the buffer size. + * * The sequence of objects is defined in the constructor by using the setStart and setNext functions. * * @ingroup serialize */ -template -class SerialFixedArrayListAdapter : public FixedArrayList, public SerializeIF { +template +class SerialFixedArrayListAdapter : public FixedArrayList, public SerializeIF { public: template - SerialFixedArrayListAdapter(Args... args) : FixedArrayList(std::forward(args)...) { + SerialFixedArrayListAdapter(Args... args) : FixedArrayList(std::forward(args)...) { } ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, const uint32_t max_size, bool bigEndian) const { - return SerialArrayListAdapter::serialize(this, buffer, size, max_size, bigEndian); + return SerialArrayListAdapter::serialize(this, buffer, size, max_size, bigEndian); } uint32_t getSerializedSize() const { - return SerialArrayListAdapter::getSerializedSize(this); + return SerialArrayListAdapter::getSerializedSize(this); } ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size, bool bigEndian) { - return SerialArrayListAdapter::deSerialize(this, buffer, size, bigEndian); + return SerialArrayListAdapter::deSerialize(this, buffer, size, bigEndian); } };