PhotonVision C++ dev-v2025.0.0-beta-8-2-gbd1c5c03
Loading...
Searching...
No Matches
photon::Packet Class Reference

A packet that holds byte-packed data to be sent over NetworkTables. More...

#include <photon/dataflow/structures/Packet.h>

Public Member Functions

 Packet (int initialCapacity=0)
 Constructs an empty packet.
 
 Packet (std::vector< uint8_t > data)
 Constructs a packet with the given data.
 
void Clear ()
 Clears the packet and resets the read and write positions.
 
const std::vector< uint8_t > & GetData ()
 Returns the packet data.
 
size_t GetDataSize () const
 Returns the number of bytes in the data.
 
template<typename T , typename... I>
requires wpi::StructSerializable<T, I...>
void Pack (const T &value)
 
template<typename T >
requires (PhotonStructSerializable<T>)
void Pack (const T &value)
 
template<typename T , typename... I>
requires wpi::StructSerializable<T, I...>
Unpack ()
 
template<typename T >
requires (PhotonStructSerializable<T>)
Unpack ()
 
bool operator== (const Packet &right) const
 
bool operator!= (const Packet &right) const
 

Detailed Description

A packet that holds byte-packed data to be sent over NetworkTables.

Constructor & Destructor Documentation

◆ Packet() [1/2]

photon::Packet::Packet ( int initialCapacity = 0)
inlineexplicit

Constructs an empty packet.

◆ Packet() [2/2]

photon::Packet::Packet ( std::vector< uint8_t > data)
explicit

Constructs a packet with the given data.

Parameters
dataThe packet data.

Member Function Documentation

◆ Clear()

void photon::Packet::Clear ( )

Clears the packet and resets the read and write positions.

◆ GetData()

const std::vector< uint8_t > & photon::Packet::GetData ( )
inline

Returns the packet data.

Returns
The packet data.

◆ GetDataSize()

size_t photon::Packet::GetDataSize ( ) const
inline

Returns the number of bytes in the data.

Returns
The number of bytes in the data.

◆ operator!=()

bool photon::Packet::operator!= ( const Packet & right) const

◆ operator==()

bool photon::Packet::operator== ( const Packet & right) const

◆ Pack() [1/2]

template<typename T , typename... I>
requires wpi::StructSerializable<T, I...>
void photon::Packet::Pack ( const T & value)
inline

◆ Pack() [2/2]

template<typename T >
requires (PhotonStructSerializable<T>)
void photon::Packet::Pack ( const T & value)
inline

◆ Unpack() [1/2]

template<typename T , typename... I>
requires wpi::StructSerializable<T, I...>
T photon::Packet::Unpack ( )
inline

◆ Unpack() [2/2]

template<typename T >
requires (PhotonStructSerializable<T>)
T photon::Packet::Unpack ( )
inline

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