CCSDSPack
C++ Library for CCSDS Space Packet manipulation. i.e. generation, extraction, analisys and more
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
CCSDS::BufferHeader Class Referencefinal

Represents a fixed secondary header used as a data buffer. More...

#include <CCSDSSecondaryHeaderAbstract.h>

Inheritance diagram for CCSDS::BufferHeader:
[legend]
Collaboration diagram for CCSDS::BufferHeader:
[legend]

Public Member Functions

 BufferHeader ()=default
 
 BufferHeader (const std::vector< std::uint8_t > &data)
 Constructs a DataOnlyHeader object with all fields explicitly set.
 
ResultBool deserialize (const std::vector< std::uint8_t > &data) override
 takes a buffer if data (vector std::uint8) and creates the header
 
std::uint16_t getSize () const override
 Gets the size of the header in bytes.
 
std::string getType () const override
 Retrieves the name of the packet.
 
std::vector< std::uint8_t > serialize () const override
 Retrieves the serialized representation of the header.
 
void update (DataField *dataField) override
 Defines how the packet secondary header is updated using the data field as reference.
 
ResultBool loadFromConfig (const Config &config) override
 
- Public Member Functions inherited from CCSDS::SecondaryHeaderAbstract
virtual ~SecondaryHeaderAbstract ()=default
 
void setVariableLength (const bool bEnable)
 

Private Attributes

std::vector< std::uint8_t > m_data
 
std::uint16_t m_dataLength = 0
 
const std::string m_type = "DataOnlyHeader"
 

Additional Inherited Members

- Public Attributes inherited from CCSDS::SecondaryHeaderAbstract
bool variableLength {false}
 

Detailed Description

Represents a fixed secondary header used as a data buffer.

This class holds the raw data for the secondary header. It provides methods to serialize and deserialize the header data as a vector of bytes. The DataOnlyHeader is not associated with any specific PUS type.

Field Summary:

Note
The getSize method returns the size of the data buffer, while getDataLength returns the length of the data as set. The m_dataLength field is not tied to any other data structure or context.

Definition at line 79 of file CCSDSSecondaryHeaderAbstract.h.

Constructor & Destructor Documentation

◆ BufferHeader() [1/2]

CCSDS::BufferHeader::BufferHeader ( )
default

◆ BufferHeader() [2/2]

CCSDS::BufferHeader::BufferHeader ( const std::vector< std::uint8_t > &  data)
inlineexplicit

Constructs a DataOnlyHeader object with all fields explicitly set.

Definition at line 86 of file CCSDSSecondaryHeaderAbstract.h.

86 : m_data(data) {
87 };
std::vector< std::uint8_t > m_data

Member Function Documentation

◆ deserialize()

ResultBool CCSDS::BufferHeader::deserialize ( const std::vector< std::uint8_t > &  data)
inlineoverridevirtual

takes a buffer if data (vector std::uint8) and creates the header

Returns
Boolean true on success or Error.

Implements CCSDS::SecondaryHeaderAbstract.

Definition at line 89 of file CCSDSSecondaryHeaderAbstract.h.

89{m_data = data; return true;};

◆ getSize()

std::uint16_t CCSDS::BufferHeader::getSize ( ) const
inlineoverridevirtual

Gets the size of the header in bytes.

Returns
The size of the header in bytes.

Implements CCSDS::SecondaryHeaderAbstract.

Definition at line 91 of file CCSDSSecondaryHeaderAbstract.h.

91{ return m_data.size(); }

◆ getType()

std::string CCSDS::BufferHeader::getType ( ) const
inlineoverridevirtual

Retrieves the name of the packet.

Returns
A vector containing the header bytes. (does not include data field)

Implements CCSDS::SecondaryHeaderAbstract.

Definition at line 92 of file CCSDSSecondaryHeaderAbstract.h.

92{ return m_type; }

◆ loadFromConfig()

ResultBool CCSDS::BufferHeader::loadFromConfig ( const Config config)
inlineoverridevirtual

Implements CCSDS::SecondaryHeaderAbstract.

Definition at line 97 of file CCSDSSecondaryHeaderAbstract.h.

97{return true;};

◆ serialize()

std::vector< std::uint8_t > CCSDS::BufferHeader::serialize ( ) const
inlineoverridevirtual

Retrieves the serialized representation of the header.

Returns
A vector containing the header bytes. (does not include data field)

Implements CCSDS::SecondaryHeaderAbstract.

Definition at line 94 of file CCSDSSecondaryHeaderAbstract.h.

94{return m_data;};

◆ update()

void CCSDS::BufferHeader::update ( DataField dataField)
inlineoverridevirtual

Defines how the packet secondary header is updated using the data field as reference.

This method is called every time a data get is performed from the packet, that is if update is enabled and method successfully registered.

Parameters
dataField

Implements CCSDS::SecondaryHeaderAbstract.

Definition at line 95 of file CCSDSSecondaryHeaderAbstract.h.

Member Data Documentation

◆ m_data

std::vector<std::uint8_t> CCSDS::BufferHeader::m_data
private

Definition at line 101 of file CCSDSSecondaryHeaderAbstract.h.

◆ m_dataLength

std::uint16_t CCSDS::BufferHeader::m_dataLength = 0
private

Definition at line 102 of file CCSDSSecondaryHeaderAbstract.h.

◆ m_type

const std::string CCSDS::BufferHeader::m_type = "DataOnlyHeader"
private

Definition at line 103 of file CCSDSSecondaryHeaderAbstract.h.


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