Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::InformationPacket Class Reference

Packet manipulation class. More...

#include <InformationPacket.h>

Classes

struct  Header
 Byte aligned packet header. More...
 
struct  PayloadInitialize
 Packet payload for tInitialize type. More...
 
struct  PayloadPingPong
 Packet payload for tPingPong type. More...
 

Public Types

enum  EType : uint8_t {
  tInitialize = 0 , tPingPong , tVariableInfo , tVariable ,
  tResultData
}
 Enumeration packet types used in the packet header. More...
 

Public Member Functions

 InformationPacket ()=default
 Default constructor.
 
template<typename T >
T * allocatePayload (EType type)
 Allocates the memory needed for the packet.
 
const Header & getHeader () const
 Gets the header of the current packet.
 
Header & getHeader ()
 Gets the header of the current packet.
 
template<typename T >
const T & getPayload () const
 Gets a typed payload of the current packet.
 
template<typename T >
T & getPayload ()
 Gets a typed payload of the current packet.
 
const char * data () const
 Gets the data pointer of the buffer.
 
char * data ()
 Gets the data pointer of the buffer.
 
size_t size () const
 Gets the size of the packet buffer.
 
void resizePayload (size_t sz)
 Resizes the buffer to include the .
 

Static Public Member Functions

static size_t headerSize ()
 Default constructor.
 

Detailed Description

Packet manipulation class.

Member Enumeration Documentation

◆ EType

Enumeration packet types used in the packet header.

Enumerator
tInitialize 

Send version to compare get same version and pass what data to subscribe to.

tPingPong 

Sends a packet and it should return it only incrementing the counter.

tVariableInfo 
tVariable 
tResultData 

Constructor & Destructor Documentation

◆ InformationPacket()

sf::InformationPacket::InformationPacket ( )
default

Default constructor.

Member Function Documentation

◆ allocatePayload()

template<typename T >
T * sf::InformationPacket::allocatePayload ( EType  type)
inline

Allocates the memory needed for the packet.

◆ data() [1/2]

char * sf::InformationPacket::data ( )
inline

Gets the data pointer of the buffer.

◆ data() [2/2]

const char * sf::InformationPacket::data ( ) const
inline

Gets the data pointer of the buffer.

◆ getHeader() [1/2]

Header & sf::InformationPacket::getHeader ( )
inline

Gets the header of the current packet.

◆ getHeader() [2/2]

const Header & sf::InformationPacket::getHeader ( ) const
inline

Gets the header of the current packet.

◆ getPayload() [1/2]

template<typename T >
T & sf::InformationPacket::getPayload ( )
inline

Gets a typed payload of the current packet.

◆ getPayload() [2/2]

template<typename T >
const T & sf::InformationPacket::getPayload ( ) const
inline

Gets a typed payload of the current packet.

◆ headerSize()

static size_t sf::InformationPacket::headerSize ( )
inlinestatic

Default constructor.

◆ resizePayload()

void sf::InformationPacket::resizePayload ( size_t  sz)
inline

Resizes the buffer to include the .

◆ size()

size_t sf::InformationPacket::size ( ) const
inline

Gets the size of the packet buffer.


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