VOX
A little voxel engine
Loading...
Searching...
No Matches
DisconnectPacket.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "IPacket.hpp"
4
6{
7public:
9 DisconnectPacket(uint32_t player_id);
11
16
17 void Serialize(uint8_t * buffer) const override;
18 void Deserialize(const uint8_t * buffer) override;
19 uint32_t Size() const override;
20 bool HasDynamicSize() const override;
21 IPacket::Type GetType() const override;
22
23 std::shared_ptr<IPacket> Clone() const override;
24
25 uint32_t GetPlayerId() const;
26
27 void SetPlayerId(uint32_t player_id);
28private:
29 uint32_t m_player_id;
30};
Definition: DisconnectPacket.hpp:6
IPacket::Type GetType() const override
Get the Type of the packet.
Definition: DisconnectPacket.cpp:76
void Serialize(uint8_t *buffer) const override
will write the packet in the buffer, the buffer must at least be of size Size()
Definition: DisconnectPacket.cpp:48
uint32_t Size() const override
return the size of the packet in bytes, usually used to reserve the right amount of memory in the sen...
Definition: DisconnectPacket.cpp:66
void SetPlayerId(uint32_t player_id)
Definition: DisconnectPacket.cpp:91
~DisconnectPacket()
Definition: DisconnectPacket.cpp:44
uint32_t GetPlayerId() const
Definition: DisconnectPacket.cpp:86
bool HasDynamicSize() const override
Tell if the packet has a dynamic size.
Definition: DisconnectPacket.cpp:71
DisconnectPacket & operator=(const DisconnectPacket &other)
Definition: DisconnectPacket.cpp:34
std::shared_ptr< IPacket > Clone() const override
Create a new instance of the packet.
Definition: DisconnectPacket.cpp:81
void Deserialize(const uint8_t *buffer) override
read the packet from the buffer, the buffer must at least be of size Size()
Definition: DisconnectPacket.cpp:58
DisconnectPacket()
Definition: DisconnectPacket.cpp:3
an abstract class that servers as a base for all network packets
Definition: IPacket.hpp:40
Type
Definition: IPacket.hpp:48