1 #ifndef SERIALIZABLE_HPP
2 #define SERIALIZABLE_HPP
23 class SerializeBufferBase;
33 #if FW_SERIALIZABLE_TO_STRING || FW_ENABLE_TEXT_LOGGING || BUILD_UT
38 friend std::ostream& operator<<(std::ostream& os,
const Serializable& val);
66 #if FW_HAS_16_BIT == 1
70 #if FW_HAS_32_BIT == 1
74 #if FW_HAS_64_BIT == 1
114 #if FW_HAS_16_BIT == 1
119 #if FW_HAS_32_BIT == 1
123 #if FW_HAS_64_BIT == 1
245 (void)SerializeBufferBase::operator=(src);
int8_t I8
8-bit signed integer
float F32
32-bit floating point
uint8_t U8
8-bit unsigned integer
PlatformUIntType NATIVE_UINT_TYPE
PlatformSizeType FwSizeType
C++-compatible configuration header for fprime configuration.
External serialize buffer with no copy semantics.
~ExternalSerializeBuffer()
U8 * getBuffAddr()
gets buffer address for data filling
ExternalSerializeBuffer(const ExternalSerializeBuffer &src)=delete
deleted copy constructor
Serializable::SizeType getBuffCapacity() const
returns capacity, not current size, of buffer
U8 * m_buff
pointer to external buffer
void setExtBuffer(U8 *buffPtr, Serializable::SizeType size)
void clear()
clear external buffer
ExternalSerializeBuffer()
default constructor
ExternalSerializeBuffer & operator=(const SerializeBufferBase &src)=delete
deleted copy assignment operator
Serializable::SizeType m_buffSize
size of external buffer
ExternalSerializeBufferWithDataCopy(const SerializeBufferBase &src)=delete
ExternalSerializeBufferWithDataCopy()
ExternalSerializeBufferWithDataCopy(U8 *buffPtr, Serializable::SizeType size)
ExternalSerializeBufferWithDataCopy & operator=(SerializeBufferBase &src)
~ExternalSerializeBufferWithDataCopy()
ExternalSerializeBufferWithMemberCopy(const ExternalSerializeBufferWithMemberCopy &src)
ExternalSerializeBufferWithMemberCopy()
ExternalSerializeBufferWithMemberCopy(U8 *buffPtr, Serializable::SizeType size)
ExternalSerializeBufferWithMemberCopy & operator=(const ExternalSerializeBufferWithMemberCopy &src)
~ExternalSerializeBufferWithMemberCopy()
NATIVE_UINT_TYPE SizeType
Serializable()
Default constructor.
virtual ~Serializable()
destructor
virtual SerializeStatus deserialize(SerializeBufferBase &buffer)=0
deserialize to contents
virtual SerializeStatus serialize(SerializeBufferBase &buffer) const =0
serialize contents
@ OMIT_LENGTH
Omit length from serialization.
@ INCLUDE_LENGTH
Include length as first token in serialization.
virtual U8 * getBuffAddr()=0
gets buffer address for data filling
SerializeStatus deserializeSize(FwSizeType &size)
deserialize a size value
SerializeStatus setBuffLen(Serializable::SizeType length)
sets buffer length manually after filling with data
void resetDeser()
reset deserialization to beginning
SerializeStatus moveDeserToOffset(FwSizeType offset)
Moves deserialization to the specified offset.
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
const U8 * getBuffAddrLeft() const
gets address of remaining non-deserialized data.
void resetSer()
reset to beginning of buffer to reuse for serialization
SerializeStatus serializeSkip(FwSizeType numBytesToSkip)
Skips the number of specified bytes for serialization.
SerializeStatus moveSerToOffset(FwSizeType offset)
Moves serialization to the specified offset.
SerializeBufferBase()
default constructor
Serializable::SizeType getBuffLength() const
returns current buffer size
SerializeBufferBase & operator=(const SerializeBufferBase &src)
copy assignment operator
SerializeStatus setBuff(const U8 *src, Serializable::SizeType length)
sets buffer contents and size
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
virtual ~SerializeBufferBase()
destructor
SerializeStatus deserializeSkip(FwSizeType numBytesToSkip)
Skips the number of specified bytes for deserialization.
SerializeStatus copyRaw(SerializeBufferBase &dest, Serializable::SizeType size)
directly copies buffer without looking for a size in the stream.
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
virtual const U8 * getBuffAddr() const =0
gets buffer address for data reading, const version
SerializeStatus copyRawOffset(SerializeBufferBase &dest, Serializable::SizeType size)
directly copies buffer without looking for a size in the stream.
virtual Serializable::SizeType getBuffCapacity() const =0
returns capacity, not current size, of buffer
SerializeStatus serializeSize(const FwSizeType size)
serialize a size value
SerializeStatus
forward declaration for string
@ FW_DESERIALIZE_FORMAT_ERROR
Deserialization data had incorrect values (unexpected data types)
@ FW_DESERIALIZE_BUFFER_EMPTY
Deserialization buffer was empty when trying to read more data.
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
@ FW_SERIALIZE_FORMAT_ERROR
Data was the wrong format (e.g. wrong packet type)
@ FW_DESERIALIZE_TYPE_MISMATCH
Deserialized type ID didn't match.
@ FW_DESERIALIZE_SIZE_MISMATCH
Data was left in the buffer, but not enough to deserialize.
@ FW_SERIALIZE_NO_ROOM_LEFT
No room left in the buffer to serialize data.