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< uint8_t > &data)
 Constructs a DataOnlyHeader object with all fields explicitly set.
 
void setDataLength (const uint16_t dataLength) override
 Sets the length of the data associated with the packet.
 
ResultBool deserialize (const std::vector< uint8_t > &data) override
 takes a buffer if data (vector uint8) and creates the header
 
uint16_t getDataLength () const override
 Gets the length of the data associated with the packet if applicable.
 
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< uint8_t > serialize () const override
 Retrieves the serialized representation of the header.
 
- Public Member Functions inherited from CCSDS::SecondaryHeaderAbstract
virtual ~SecondaryHeaderAbstract ()=default
 

Private Attributes

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

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 70 of file CCSDSSecondaryHeaderAbstract.h.

Constructor & Destructor Documentation

◆ BufferHeader() [1/2]

CCSDS::BufferHeader::BufferHeader ( )
default

◆ BufferHeader() [2/2]

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

Constructs a DataOnlyHeader object with all fields explicitly set.

Definition at line 77 of file CCSDSSecondaryHeaderAbstract.h.

77 : m_data(data) {
78 };
std::vector< uint8_t > m_data

Member Function Documentation

◆ deserialize()

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

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

Returns
Boolean true on success or Error.

Implements CCSDS::SecondaryHeaderAbstract.

Definition at line 82 of file CCSDSSecondaryHeaderAbstract.h.

82{m_data = data; return true;};

◆ getDataLength()

uint16_t CCSDS::BufferHeader::getDataLength ( ) const
inlineoverridevirtual

Gets the length of the data associated with the packet if applicable.

Returns
The length of the data in bytes set in the header.

Implements CCSDS::SecondaryHeaderAbstract.

Definition at line 84 of file CCSDSSecondaryHeaderAbstract.h.

◆ getSize()

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 85 of file CCSDSSecondaryHeaderAbstract.h.

85{ 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 86 of file CCSDSSecondaryHeaderAbstract.h.

86{ return m_type; }

◆ serialize()

std::vector< 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 88 of file CCSDSSecondaryHeaderAbstract.h.

88{return m_data;};

◆ setDataLength()

void CCSDS::BufferHeader::setDataLength ( const uint16_t  dataLength)
inlineoverridevirtual

Sets the length of the data associated with the packet.

Parameters
dataLengthLength of the data in bytes.

Implements CCSDS::SecondaryHeaderAbstract.

Definition at line 80 of file CCSDSSecondaryHeaderAbstract.h.

80{ m_dataLength = dataLength; }

Member Data Documentation

◆ m_data

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

Definition at line 91 of file CCSDSSecondaryHeaderAbstract.h.

◆ m_dataLength

uint16_t CCSDS::BufferHeader::m_dataLength = 0
private

Definition at line 92 of file CCSDSSecondaryHeaderAbstract.h.

◆ m_type

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

Definition at line 93 of file CCSDSSecondaryHeaderAbstract.h.


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