serialize tools more documentation

This commit is contained in:
Robin Müller 2019-11-02 23:30:12 +01:00
parent d47496db40
commit 46986f69e4
5 changed files with 35 additions and 8 deletions

View File

@ -5,15 +5,15 @@
template<typename T>
SerialBufferAdapter<T>::SerialBufferAdapter(const uint8_t* buffer,
T bufferLength, bool serializeLenght) :
serializeLength(serializeLenght), constBuffer(buffer), buffer(NULL), bufferLength(
T bufferLength, bool serializeLength) :
serializeLength(serializeLength), constBuffer(buffer), buffer(NULL), bufferLength(
bufferLength) {
}
template<typename T>
SerialBufferAdapter<T>::SerialBufferAdapter(uint8_t* buffer, T bufferLength,
bool serializeLenght) :
serializeLength(serializeLenght), constBuffer(NULL), buffer(buffer), bufferLength(
bool serializeLength) :
serializeLength(serializeLength), constBuffer(NULL), buffer(buffer), bufferLength(
bufferLength) {
}

View File

@ -5,6 +5,14 @@
#include <framework/serialize/SerializeAdapter.h>
/**
* This adapter provides an interface for SerializeIF to serialize or deserialize
* buffers with no length header but a known size.
*
* 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<SerialBufferAdapter<T(will be uint8_t mostly)>> serialBufferElement
*
* \ingroup serialize
*/
template<typename T>

View File

@ -5,6 +5,17 @@
#include <framework/serialize/SerialArrayListAdapter.h>
/**
* This adapter provides an interface for SerializeIF to serialize and deserialize
* buffers with a header containing the buffer length.
*
* Can be used by SerialLinkedListAdapter.
*
* Buffers with a size header inside that class can be declared with
* SerialFixedArrayListAdapter<uint8_t,MAX_BUFFER_LENGTH,typeOfMaxData>.
* 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.
* The sequence of objects is defined in the constructor by using the setStart and setNext functions.
*
* \ingroup serialize
*/
template<typename T, uint32_t MAX_SIZE, typename count_t = uint8_t>

View File

@ -17,12 +17,20 @@
* An alternative to the AutoSerializeAdapter functions to implement the conversion
* of object data to data streams or vice-versa, using linked lists.
*
* All object members with a datatype are declared as SerializeElement<element_type> inside the class.
* All object members with a datatype are declared as SerializeElement<element_type> inside the class
* implementing this adapter.
*
* Buffers with a size header inside that class can be declared with
* SerialFixedArrayListAdapter<uint8_t,MAX_BUFFER_LENGTH,typeOfMaxData>.
* 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.
* Please note that a direct link from a linked element to a SerialFixedArrayListAdapter element is not possible and a
* helper needs to be used by calling <LinkedElement>.setNext(&linkHelper)
* and initialising the link helper as linkHelper(&SerialFixedArrayListAdapterElement).
*
* For buffers with no size header, declare
* SerializeElement<SerializeBufferAdapter<T>> and initialise the buffer adapter in the constructor.
*
* The sequence of objects is defined in the constructor by using the setStart and setNext functions.
*
* The serialization and deserialization process is done by instantiating the class and

View File

@ -11,14 +11,14 @@
/**
* An interface for alle classes which require translation of objects data into data streams and vice-versa.
*
* If the target architecture is little endian (ARM), any data types created might
* If the target architecture is little endian (e.g. ARM), any data types created might
* have the wrong endiness if they are to be used for the FSFW.
* there are three ways to retrieve data out of a buffer to be used in the FSFW to use regular aligned (big endian) data.
* There are three ways to retrieve data out of a buffer to be used in the FSFW to use regular aligned (big endian) data.
* This can also be applied to uint32_t and uint64_t:
*
* 1. Use the @c AutoSerializeAdapter::deSerialize function with @c bigEndian = true
* 2. Perform a bitshift operation
* 3. @c memcpy can be used when data is little-endian. Otherwise, @c EndianSwapper has to be used.
* 3. @c memcpy can be used when data is in little-endian format. Otherwise, @c EndianSwapper has to be used in conjuction.
*
* When serializing for downlink, the packets are generally serialized assuming big endian data format
* like seen in TmPacketStored.cpp for example.