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 receivedmessagenumber=0)
 
virtual ~NetworkRequest ()
 
void AddDataToPacket (sf::Packet &packet) const
 
NETWORK_REQUEST_TYPE GetType () const
 
DLLEXPORT std::string GetTypeStr () const
 
uint32_t GetMessageNumber () const
 
uint32_t GetIDForResponse () const
 The id number for a response to this is the same as the message number that this request is in. More...
 

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 MessageNumber = 0
 This is only valid when this is received. More...
 

Detailed Description

Definition at line 129 of file NetworkRequest.h.

Constructor & Destructor Documentation

◆ RequestCustom() [1/2]

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

Definition at line 131 of file NetworkRequest.h.

131  :
133  {}
All values above this are application specific types.
std::shared_ptr< GameSpecificPacketData > ActualRequest
NetworkRequest(NETWORK_REQUEST_TYPE type, uint32_t receivedmessagenumber=0)

◆ RequestCustom() [2/2]

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

Definition at line 141 of file NetworkRequest.h.

141  :
143  {
144  ActualRequest = handler.ReadGameSpecificPacketFromPacket(false, packet);
145 
146  if(!ActualRequest) {
147 
148  throw InvalidArgument("invalid packet format for user defined request");
149  }
150  }
All values above this are application specific types.
std::shared_ptr< GameSpecificPacketData > ActualRequest
NetworkRequest(NETWORK_REQUEST_TYPE type, uint32_t receivedmessagenumber=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 135 of file NetworkRequest.h.

136  {
137 
138  LEVIATHAN_ASSERT(0, "_SerializeCustom called on RequestCustom");
139  }
#define LEVIATHAN_ASSERT(x, msg)
Definition: Define.h:92

◆ AddDataToPacket()

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

Definition at line 152 of file NetworkRequest.h.

153  {
154 
155  packet << static_cast<uint16_t>(Type);
156 
157  handler.PassGameSpecificDataToPacket(ActualRequest.get(), packet);
158  }
const NETWORK_REQUEST_TYPE Type
std::shared_ptr< GameSpecificPacketData > ActualRequest

Member Data Documentation

◆ ActualRequest

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

Definition at line 160 of file NetworkRequest.h.


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