serialize tools more documentation
This commit is contained in:
parent
d47496db40
commit
46986f69e4
@ -5,15 +5,15 @@
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
SerialBufferAdapter<T>::SerialBufferAdapter(const uint8_t* buffer,
|
SerialBufferAdapter<T>::SerialBufferAdapter(const uint8_t* buffer,
|
||||||
T bufferLength, bool serializeLenght) :
|
T bufferLength, bool serializeLength) :
|
||||||
serializeLength(serializeLenght), constBuffer(buffer), buffer(NULL), bufferLength(
|
serializeLength(serializeLength), constBuffer(buffer), buffer(NULL), bufferLength(
|
||||||
bufferLength) {
|
bufferLength) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
SerialBufferAdapter<T>::SerialBufferAdapter(uint8_t* buffer, T bufferLength,
|
SerialBufferAdapter<T>::SerialBufferAdapter(uint8_t* buffer, T bufferLength,
|
||||||
bool serializeLenght) :
|
bool serializeLength) :
|
||||||
serializeLength(serializeLenght), constBuffer(NULL), buffer(buffer), bufferLength(
|
serializeLength(serializeLength), constBuffer(NULL), buffer(buffer), bufferLength(
|
||||||
bufferLength) {
|
bufferLength) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,14 @@
|
|||||||
#include <framework/serialize/SerializeAdapter.h>
|
#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
|
* \ingroup serialize
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -5,6 +5,17 @@
|
|||||||
#include <framework/serialize/SerialArrayListAdapter.h>
|
#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
|
* \ingroup serialize
|
||||||
*/
|
*/
|
||||||
template<typename T, uint32_t MAX_SIZE, typename count_t = uint8_t>
|
template<typename T, uint32_t MAX_SIZE, typename count_t = uint8_t>
|
||||||
|
@ -17,12 +17,20 @@
|
|||||||
* An alternative to the AutoSerializeAdapter functions to implement the conversion
|
* An alternative to the AutoSerializeAdapter functions to implement the conversion
|
||||||
* of object data to data streams or vice-versa, using linked lists.
|
* 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
|
* Buffers with a size header inside that class can be declared with
|
||||||
* SerialFixedArrayListAdapter<uint8_t,MAX_BUFFER_LENGTH,typeOfMaxData>.
|
* SerialFixedArrayListAdapter<uint8_t,MAX_BUFFER_LENGTH,typeOfMaxData>.
|
||||||
* typeOfMaxData specifies the data type of the buffer header containing the buffer size that follows
|
* 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.
|
* 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 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
|
* The serialization and deserialization process is done by instantiating the class and
|
||||||
|
@ -11,14 +11,14 @@
|
|||||||
/**
|
/**
|
||||||
* An interface for alle classes which require translation of objects data into data streams and vice-versa.
|
* 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.
|
* 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:
|
* This can also be applied to uint32_t and uint64_t:
|
||||||
*
|
*
|
||||||
* 1. Use the @c AutoSerializeAdapter::deSerialize function with @c bigEndian = true
|
* 1. Use the @c AutoSerializeAdapter::deSerialize function with @c bigEndian = true
|
||||||
* 2. Perform a bitshift operation
|
* 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
|
* When serializing for downlink, the packets are generally serialized assuming big endian data format
|
||||||
* like seen in TmPacketStored.cpp for example.
|
* like seen in TmPacketStored.cpp for example.
|
||||||
|
Loading…
Reference in New Issue
Block a user