R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
ENetPacketWrapper Class Referencefinal

#include <ENetPacket.hpp>

Inheritance diagram for ENetPacketWrapper:
Inheritance graph
Collaboration diagram for ENetPacketWrapper:
Collaboration graph

Public Member Functions

 ENetPacketWrapper (ENetPacket *packet)
 
 ENetPacketWrapper (const std::vector< uint8_t > &data, uint32_t flags)
 
 ~ENetPacketWrapper () override
 
 ENetPacketWrapper (const ENetPacketWrapper &)=delete
 
ENetPacketWrapperoperator= (const ENetPacketWrapper &)=delete
 
 ENetPacketWrapper (ENetPacketWrapper &&other) noexcept
 
ENetPacketWrapperoperator= (ENetPacketWrapper &&other) noexcept
 
const std::vector< uint8_t > & getData () const override
 Get the packet data as a byte buffer.
 
size_t getSize () const override
 Get the size of the packet data in bytes.
 
uint32_t getFlags () const override
 Get the flags associated with this packet.
 
void setData (const std::vector< uint8_t > &data) override
 Set new data for this packet.
 
ENetPacket * getNativePacket () const
 
- Public Member Functions inherited from IPacket
virtual ~IPacket ()=default
 

Private Attributes

ENetPacket * _packet
 
std::vector< uint8_t > _dataCache
 
bool _dataCacheValid
 

Detailed Description

Definition at line 15 of file ENetPacket.hpp.

Constructor & Destructor Documentation

◆ ENetPacketWrapper() [1/4]

ENetPacketWrapper::ENetPacketWrapper ( ENetPacket *  packet)
explicit

Definition at line 12 of file ENetPacket.cpp.

References _packet.

◆ ENetPacketWrapper() [2/4]

ENetPacketWrapper::ENetPacketWrapper ( const std::vector< uint8_t > &  data,
uint32_t  flags 
)

Definition at line 18 of file ENetPacket.cpp.

References _packet.

◆ ~ENetPacketWrapper()

ENetPacketWrapper::~ENetPacketWrapper ( )
override

Definition at line 26 of file ENetPacket.cpp.

References _packet.

◆ ENetPacketWrapper() [3/4]

ENetPacketWrapper::ENetPacketWrapper ( const ENetPacketWrapper )
delete

◆ ENetPacketWrapper() [4/4]

ENetPacketWrapper::ENetPacketWrapper ( ENetPacketWrapper &&  other)
noexcept

Definition at line 32 of file ENetPacket.cpp.

Member Function Documentation

◆ getData()

const std::vector< uint8_t > & ENetPacketWrapper::getData ( ) const
overridevirtual

Get the packet data as a byte buffer.

Returns
Const reference to the packet's data.

Implements IPacket.

Definition at line 55 of file ENetPacket.cpp.

References _dataCache, _dataCacheValid, and _packet.

◆ getFlags()

uint32_t ENetPacketWrapper::getFlags ( ) const
overridevirtual

Get the flags associated with this packet.

Returns
Packet flags.

Implements IPacket.

Definition at line 67 of file ENetPacket.cpp.

References _packet.

◆ getNativePacket()

ENetPacket * ENetPacketWrapper::getNativePacket ( ) const

Definition at line 82 of file ENetPacket.cpp.

References _packet.

◆ getSize()

size_t ENetPacketWrapper::getSize ( ) const
overridevirtual

Get the size of the packet data in bytes.

Returns
Size of the packet.

Implements IPacket.

Definition at line 63 of file ENetPacket.cpp.

References _packet.

◆ operator=() [1/2]

ENetPacketWrapper & ENetPacketWrapper::operator= ( const ENetPacketWrapper )
delete

◆ operator=() [2/2]

ENetPacketWrapper & ENetPacketWrapper::operator= ( ENetPacketWrapper &&  other)
noexcept

Definition at line 40 of file ENetPacket.cpp.

◆ setData()

void ENetPacketWrapper::setData ( const std::vector< uint8_t > &  data)
overridevirtual

Set new data for this packet.

Parameters
dataThe data to set.

Implements IPacket.

Definition at line 71 of file ENetPacket.cpp.

References _dataCacheValid, and _packet.

Member Data Documentation

◆ _dataCache

std::vector<uint8_t> ENetPacketWrapper::_dataCache
mutableprivate

Definition at line 36 of file ENetPacket.hpp.

Referenced by getData().

◆ _dataCacheValid

bool ENetPacketWrapper::_dataCacheValid
mutableprivate

Definition at line 37 of file ENetPacket.hpp.

Referenced by getData(), and setData().

◆ _packet

ENetPacket* ENetPacketWrapper::_packet
private

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