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

Interface representing a network packet. More...

#include <IPacket.hpp>

Inheritance diagram for IPacket:
Inheritance graph
Collaboration diagram for IPacket:
Collaboration graph

Public Member Functions

virtual ~IPacket ()=default
 
virtual const std::vector< uint8_t > & getData () const =0
 Get the packet data as a byte buffer.
 
virtual size_t getSize () const =0
 Get the size of the packet data in bytes.
 
virtual uint32_t getFlags () const =0
 Get the flags associated with this packet.
 
virtual void setData (const std::vector< uint8_t > &data)=0
 Set new data for this packet.
 

Detailed Description

Interface representing a network packet.

IPacket encapsulates data to be sent or received over the network. The concrete implementation (ENet, custom UDP, etc.) is hidden behind this interface so the backend can be swapped without impacting game code.

Definition at line 35 of file IPacket.hpp.

Constructor & Destructor Documentation

◆ ~IPacket()

virtual IPacket::~IPacket ( )
virtualdefault

Member Function Documentation

◆ getData()

virtual const std::vector< uint8_t > & IPacket::getData ( ) const
pure virtual

Get the packet data as a byte buffer.

Returns
Const reference to the packet's data.

Implemented in ENetPacketWrapper.

◆ getFlags()

virtual uint32_t IPacket::getFlags ( ) const
pure virtual

Get the flags associated with this packet.

Returns
Packet flags.

Implemented in ENetPacketWrapper.

◆ getSize()

virtual size_t IPacket::getSize ( ) const
pure virtual

Get the size of the packet data in bytes.

Returns
Size of the packet.

Implemented in ENetPacketWrapper.

◆ setData()

virtual void IPacket::setData ( const std::vector< uint8_t > &  data)
pure virtual

Set new data for this packet.

Parameters
dataThe data to set.

Implemented in ENetPacketWrapper.


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