Leviathan  0.8.0.0
Leviathan game engine
Leviathan::RequestCustom Class Reference

#include <NetworkRequest.h>

+ Inheritance diagram for Leviathan::RequestCustom:

Public Member Functions

 RequestCustom (std::shared_ptr< GameSpecificPacketData > actualrequest)
 
void _SerializeCustom (sf::Packet &packet) const override
 Base classes serialize their data. More...
 
 RequestCustom (GameSpecificPacketHandler &handler, sf::Packet &packet)
 
void AddDataToPacket (GameSpecificPacketHandler &handler, sf::Packet &packet)
 
- Public Member Functions inherited from Leviathan::NetworkRequest
 NetworkRequest (NETWORK_REQUEST_TYPE type, uint32_t idforresponse=0)
 
virtual ~NetworkRequest ()
 
void AddDataToPacket (sf::Packet &packet) const
 
NETWORK_REQUEST_TYPE GetType () const
 
uint32_t GetIDForResponse () const
 

Public Attributes

std::shared_ptr< GameSpecificPacketDataActualRequest
 

Additional Inherited Members

- Static Public Member Functions inherited from Leviathan::NetworkRequest
static DLLEXPORT std::shared_ptr< NetworkRequestLoadFromPacket (sf::Packet &packet, uint32_t messagenumber)
 
- Protected Attributes inherited from Leviathan::NetworkRequest
const NETWORK_REQUEST_TYPE Type
 
const uint32_t IDForResponse = 0
 

Detailed Description

Definition at line 117 of file NetworkRequest.h.

Constructor & Destructor Documentation

◆ RequestCustom() [1/2]

Leviathan::RequestCustom::RequestCustom ( std::shared_ptr< GameSpecificPacketData actualrequest)
inline

Definition at line 119 of file NetworkRequest.h.

119  :
121  ActualRequest(actualrequest)
122  {}
All values above this are application specific types.
std::shared_ptr< GameSpecificPacketData > ActualRequest
NetworkRequest(NETWORK_REQUEST_TYPE type, uint32_t idforresponse=0)

◆ RequestCustom() [2/2]

Leviathan::RequestCustom::RequestCustom ( GameSpecificPacketHandler handler,
sf::Packet &  packet 
)
inline

Definition at line 129 of file NetworkRequest.h.

129  :
131  {
132  ActualRequest = handler.ReadGameSpecificPacketFromPacket(false, packet);
133 
134  if(!ActualRequest){
135 
136  throw InvalidArgument("invalid packet format for user defined request");
137  }
138  }
All values above this are application specific types.
std::shared_ptr< GameSpecificPacketData > ActualRequest
NetworkRequest(NETWORK_REQUEST_TYPE type, uint32_t idforresponse=0)

Member Function Documentation

◆ _SerializeCustom()

void Leviathan::RequestCustom::_SerializeCustom ( sf::Packet &  packet) const
inlineoverridevirtual

Base classes serialize their data.

Implements Leviathan::NetworkRequest.

Definition at line 124 of file NetworkRequest.h.

124  {
125 
126  LEVIATHAN_ASSERT(0, "_SerializeCustom called on RequestCustom");
127  }

◆ AddDataToPacket()

void Leviathan::RequestCustom::AddDataToPacket ( GameSpecificPacketHandler handler,
sf::Packet &  packet 
)
inline

Definition at line 140 of file NetworkRequest.h.

140  {
141 
142  packet << static_cast<uint16_t>(Type);
143 
144  handler.PassGameSpecificDataToPacket(ActualRequest.get(), packet);
145  }
const NETWORK_REQUEST_TYPE Type
std::shared_ptr< GameSpecificPacketData > ActualRequest

Member Data Documentation

◆ ActualRequest

std::shared_ptr<GameSpecificPacketData> Leviathan::RequestCustom::ActualRequest

Definition at line 147 of file NetworkRequest.h.


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