Wrath of Zeus
Made by Torchlight Games for CSE 125 SP24
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
PackagedPacket Class Reference

#include <packet.hpp>

Public Member Functions

 ~PackagedPacket ()=default
 
std::array< boost::asio::const_buffer, 2 > toBuffer ()
 

Static Public Member Functions

template<class Packet >
static std::shared_ptr< PackagedPacketmake_shared (PacketType type, Packet packet)
 

Detailed Description

A class which wraps around a packet that has yet to be sent across the network. Note: this class can only be instantiated as a shared_ptr using the provided friend helper function

Constructor & Destructor Documentation

◆ ~PackagedPacket()

PackagedPacket::~PackagedPacket ( )
default

We explicitly make the destructor availabale.

Member Function Documentation

◆ make_shared()

template<class Packet >
static std::shared_ptr< PackagedPacket > PackagedPacket::make_shared ( PacketType  type,
Packet  packet 
)
inlinestatic

Factory function that creates a smart pointer for the packaged packet.

Parameters
typeof packet to make
packetactual packet data

◆ toBuffer()

std::array< boost::asio::const_buffer, 2 > PackagedPacket::toBuffer ( )
inline

Converts the PackagedPacket into asio::buffer format.

Returns
The packet in buffer format, which can easily be passed into boost::asio::write or similar function.

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