VOX
A little voxel engine
Loading...
Searching...
No Matches
LoadDistancePacket.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "IPacket.hpp"
4
5
7{
8public:
10 LoadDistancePacket(uint32_t distance);
12
15
18
19 void Serialize(uint8_t * buffer) const override;
20 void Deserialize(const uint8_t * buffer) override;
21 uint32_t Size() const override;
22 bool HasDynamicSize() const override;
23 IPacket::Type GetType() const override;
24
25 std::shared_ptr<IPacket> Clone() const override;
26 /*********************************\
27 * ATTRIBUTES
28 \*********************************/
29
30 uint32_t GetDistance() const;
31
32 void SetDistance(uint32_t distance);
33private:
34 uint32_t m_distance;
35};
an abstract class that servers as a base for all network packets
Definition: IPacket.hpp:40
Type
Definition: IPacket.hpp:48
Definition: LoadDistancePacket.hpp:7
void Deserialize(const uint8_t *buffer) override
read the packet from the buffer, the buffer must at least be of size Size()
Definition: LoadDistancePacket.cpp:57
LoadDistancePacket()
Definition: LoadDistancePacket.cpp:3
IPacket::Type GetType() const override
Get the Type of the packet.
Definition: LoadDistancePacket.cpp:77
bool HasDynamicSize() const override
Tell if the packet has a dynamic size.
Definition: LoadDistancePacket.cpp:72
LoadDistancePacket & operator=(const LoadDistancePacket &other)
Definition: LoadDistancePacket.cpp:22
uint32_t GetDistance() const
Definition: LoadDistancePacket.cpp:87
void SetDistance(uint32_t distance)
Definition: LoadDistancePacket.cpp:92
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: LoadDistancePacket.cpp:67
std::shared_ptr< IPacket > Clone() const override
Create a new instance of the packet.
Definition: LoadDistancePacket.cpp:82
~LoadDistancePacket()
Definition: LoadDistancePacket.cpp:42
void Serialize(uint8_t *buffer) const override
will write the packet in the buffer, the buffer must at least be of size Size()
Definition: LoadDistancePacket.cpp:46