F´ Flight Software - C/C++ Documentation NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
Fw::SerialBuffer Class Reference

A variable-length serializable buffer. More...

#include <Fw/Types/SerialBuffer.hpp>

Inheritance diagram for Fw::SerialBuffer:
Fw::SerializeBufferBase

Public Member Functions

 SerialBuffer (U8 *const data, const U32 capacity)
 
NATIVE_UINT_TYPE getBuffCapacity () const
 returns capacity, not current size, of buffer
 
U8getBuffAddr ()
 gets buffer address for data filling
 
const U8getBuffAddr () const
 gets buffer address for data reading, const version
 
void fill ()
 Fill the buffer to capacity with preexisting data.
 
SerializeStatus pushBytes (const U8 *const addr, const NATIVE_UINT_TYPE n)
 Push n bytes onto the buffer.
 
SerializeStatus popBytes (U8 *const addr, NATIVE_UINT_TYPE n)
 Pop n bytes off the buffer.
 
- Public Member Functions inherited from Fw::SerializeBufferBase
SerializeBufferBaseoperator= (const SerializeBufferBase &src)
 equal operator
 
virtual ~SerializeBufferBase ()
 destructor
 
SerializeStatus serialize (U8 val)
 serialize 8-bit unsigned int
 
SerializeStatus serialize (I8 val)
 serialize 8-bit signed int
 
SerializeStatus serialize (F32 val)
 serialize 32-bit floating point
 
SerializeStatus serialize (bool val)
 serialize boolean
 
SerializeStatus serialize (const void *val)
 serialize pointer (careful, only pointer value, not contents are serialized)
 
SerializeStatus serialize (const U8 *buff, NATIVE_UINT_TYPE length, bool noLength=false)
 serialize data buffer
 
SerializeStatus serialize (const SerializeBufferBase &val)
 serialize a serialized buffer
 
SerializeStatus serialize (const Serializable &val)
 serialize an object derived from serializable base class
 
SerializeStatus deserialize (U8 &val)
 deserialize 8-bit unsigned int
 
SerializeStatus deserialize (I8 &val)
 deserialize 8-bit signed int
 
SerializeStatus deserialize (F32 &val)
 deserialize 32-bit floating point
 
SerializeStatus deserialize (bool &val)
 deserialize boolean
 
SerializeStatus deserialize (void *&val)
 deserialize point value (careful, pointer value only, not contents)
 
SerializeStatus deserialize (U8 *buff, NATIVE_UINT_TYPE &length, bool noLength=false)
 deserialize data buffer
 
SerializeStatus deserialize (Serializable &val)
 deserialize an object derived from serializable base class
 
SerializeStatus deserialize (SerializeBufferBase &val)
 serialize a serialized buffer
 
void resetSer ()
 reset to beginning of buffer to reuse for serialization
 
void resetDeser ()
 reset deserialization to beginning
 
SerializeStatus deserializeSkip (NATIVE_UINT_TYPE numBytesToSkip)
 Skips the number of specified bytes for deserialization.
 
virtual NATIVE_UINT_TYPE getBuffCapacity () const =0
 returns capacity, not current size, of buffer
 
NATIVE_UINT_TYPE getBuffLength () const
 returns current buffer size
 
NATIVE_UINT_TYPE getBuffLeft () const
 returns how much deserialization buffer is left
 
virtual U8getBuffAddr ()=0
 gets buffer address for data filling
 
virtual const U8getBuffAddr () const =0
 gets buffer address for data reading, const version
 
const U8getBuffAddrLeft () const
 gets address of remaining non-deserialized data.
 
U8getBuffAddrSer ()
 gets address of end of serialization. DANGEROUS! Need to know max buffer size and adjust when done
 
SerializeStatus setBuff (const U8 *src, NATIVE_UINT_TYPE length)
 sets buffer contents and size
 
SerializeStatus setBuffLen (NATIVE_UINT_TYPE length)
 sets buffer length manually after filling with data
 
SerializeStatus copyRaw (SerializeBufferBase &dest, NATIVE_UINT_TYPE size)
 directly copies buffer without looking for a size in the stream.
 
SerializeStatus copyRawOffset (SerializeBufferBase &dest, NATIVE_UINT_TYPE size)
 directly copies buffer without looking for a size in the stream.
 

Additional Inherited Members

- Protected Member Functions inherited from Fw::SerializeBufferBase
 SerializeBufferBase ()
 default constructor
 

Detailed Description

A variable-length serializable buffer.

Definition at line 24 of file SerialBuffer.hpp.

Constructor & Destructor Documentation

◆ SerialBuffer()

Fw::SerialBuffer::SerialBuffer ( U8 *const  data,
const U32  capacity 
)

Construct a SerialBuffer

Parameters
dataPointer to the data
capacityThe buffer capacity

Definition at line 18 of file SerialBuffer.cpp.

Member Function Documentation

◆ fill()

void Fw::SerialBuffer::fill ( )

Fill the buffer to capacity with preexisting data.

Definition at line 47 of file SerialBuffer.cpp.

◆ getBuffAddr() [1/2]

U8 * Fw::SerialBuffer::getBuffAddr ( )
virtual

gets buffer address for data filling

Implements Fw::SerializeBufferBase.

Definition at line 35 of file SerialBuffer.cpp.

◆ getBuffAddr() [2/2]

const U8 * Fw::SerialBuffer::getBuffAddr ( ) const
virtual

gets buffer address for data reading, const version

Implements Fw::SerializeBufferBase.

Definition at line 41 of file SerialBuffer.cpp.

◆ getBuffCapacity()

NATIVE_UINT_TYPE Fw::SerialBuffer::getBuffCapacity ( ) const
virtual

returns capacity, not current size, of buffer

Implements Fw::SerializeBufferBase.

Definition at line 29 of file SerialBuffer.cpp.

◆ popBytes()

SerializeStatus Fw::SerialBuffer::popBytes ( U8 *const  addr,
NATIVE_UINT_TYPE  n 
)

Pop n bytes off the buffer.

Parameters
addrAddress of bytes to pop
nNumber of bytes to pop

Definition at line 61 of file SerialBuffer.cpp.

◆ pushBytes()

SerializeStatus Fw::SerialBuffer::pushBytes ( const U8 *const  addr,
const NATIVE_UINT_TYPE  n 
)

Push n bytes onto the buffer.

Parameters
addrAddress of bytes to push
nNumber of bytes

Definition at line 54 of file SerialBuffer.cpp.


The documentation for this class was generated from the following files: