Leviathan  0.8.0.0
Leviathan game engine
Leviathan::ResponseCustom Class Reference

Used for BaseGameSpecificResponsePacket storing. More...

#include <NetworkResponse.h>

+ Inheritance diagram for Leviathan::ResponseCustom:

Public Member Functions

 ResponseCustom (uint32_t responseid, std::shared_ptr< GameSpecificPacketData > actualresponse)
 
void _SerializeCustom (sf::Packet &packet) const override
 Base classes serialize their data. More...
 
void AddDataToPacket (GameSpecificPacketHandler &handler, sf::Packet &packet)
 
 ResponseCustom (GameSpecificPacketHandler &handler, uint32_t responseid, sf::Packet &packet)
 
- Public Member Functions inherited from Leviathan::NetworkResponse
 NetworkResponse (NETWORK_RESPONSE_TYPE type, uint32_t responseid)
 
virtual ~NetworkResponse ()
 
void AddDataToPacket (sf::Packet &packet) const
 
NETWORK_RESPONSE_TYPE GetType () const
 
DLLEXPORT std::string GetTypeStr () const
 
auto GetResponseID () const
 

Public Attributes

std::shared_ptr< GameSpecificPacketDataActualResponse
 

Additional Inherited Members

- Static Public Member Functions inherited from Leviathan::NetworkResponse
static DLLEXPORT std::shared_ptr< NetworkResponseLoadFromPacket (sf::Packet &packet)
 
static DLLEXPORT void LimitResponseSize (ResponseIdentification &response, uint32_t maxsize)
 Limits size of response to avoid the application being used for DDoS amplification. More...
 
- Protected Attributes inherited from Leviathan::NetworkResponse
const NETWORK_RESPONSE_TYPE Type
 Type of response. Specifies which subclass this object is. More...
 
const uint32_t ResponseID = 0
 

Detailed Description

Used for BaseGameSpecificResponsePacket storing.

Definition at line 190 of file NetworkResponse.h.

Constructor & Destructor Documentation

◆ ResponseCustom() [1/2]

Leviathan::ResponseCustom::ResponseCustom ( uint32_t  responseid,
std::shared_ptr< GameSpecificPacketData actualresponse 
)
inline

Definition at line 192 of file NetworkResponse.h.

193  :
195  ActualResponse(actualresponse)
196  {}
All values above this are application specific types.
NetworkResponse(NETWORK_RESPONSE_TYPE type, uint32_t responseid)
std::shared_ptr< GameSpecificPacketData > ActualResponse

◆ ResponseCustom() [2/2]

Leviathan::ResponseCustom::ResponseCustom ( GameSpecificPacketHandler handler,
uint32_t  responseid,
sf::Packet &  packet 
)
inline

Definition at line 212 of file NetworkResponse.h.

213  :
215  {
216  ActualResponse = handler.ReadGameSpecificPacketFromPacket(true, packet);
217  if(!ActualResponse) {
218 
219  throw InvalidArgument("invalid packet format for user defined response");
220  }
221  }
All values above this are application specific types.
NetworkResponse(NETWORK_RESPONSE_TYPE type, uint32_t responseid)
std::shared_ptr< GameSpecificPacketData > ActualResponse

Member Function Documentation

◆ _SerializeCustom()

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

Base classes serialize their data.

Implements Leviathan::NetworkResponse.

Definition at line 198 of file NetworkResponse.h.

199  {
200 
201  LEVIATHAN_ASSERT(0, "_SerializeCustom called on ResponseCustom");
202  }
#define LEVIATHAN_ASSERT(x, msg)
Definition: Define.h:92

◆ AddDataToPacket()

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

Definition at line 204 of file NetworkResponse.h.

205  {
206 
207  packet << ResponseID << static_cast<uint16_t>(Type);
208 
209  handler.PassGameSpecificDataToPacket(ActualResponse.get(), packet);
210  }
const NETWORK_RESPONSE_TYPE Type
Type of response. Specifies which subclass this object is.
std::shared_ptr< GameSpecificPacketData > ActualResponse

Member Data Documentation

◆ ActualResponse

std::shared_ptr<GameSpecificPacketData> Leviathan::ResponseCustom::ActualResponse

Definition at line 223 of file NetworkResponse.h.


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