#ifndef SERIALFIXEDARRAYLISTADAPTER_H_ #define SERIALFIXEDARRAYLISTADAPTER_H_ #include #include /** * @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 declaring * as a linked element with SerializeElement>. * The sequence of objects is defined in the constructor by * using the setStart and setNext functions. * * - Buffers with a size header inside that class can be declared with * @code * SerialFixedArrayListAdapter mySerialFixedArrayList(...). * @endcode * * - MAX_SIZE: specifies the maximum allowed number of elements * in FixedArrayList. * - BUFFER_TYPE: specifies the data type of the buffer * - count_t: specifies the type/size of the length field * which defaults to one byte. * * @ingroup serialize */ template class SerialFixedArrayListAdapter : public FixedArrayList, public SerializeIF { public: /** * Constructor Arguments are forwarded to FixedArrayList constructor. * Refer to the fixed array list constructors for different options. * @param args */ template SerialFixedArrayListAdapter(Args... args) : FixedArrayList(std::forward(args)...) {} virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, const size_t max_size, bool bigEndian) const override { return SerialArrayListAdapter::serialize(this, buffer, size, max_size, bigEndian); } size_t getSerializedSize() const { return SerialArrayListAdapter:: getSerializedSize(this); } virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, bool bigEndian) override { return SerialArrayListAdapter::deSerialize(this, buffer, size, bigEndian); } void swapArrayListEndianness() { SerialArrayListAdapter:: swapArrayListEndianness(this); } }; #endif /* SERIALFIXEDARRAYLISTADAPTER_H_ */