Go to the documentation of this file.
21 #ifndef THUNDEREGG_BUFFERREADER_H
22 #define THUNDEREGG_BUFFERREADER_H
32 #include <type_traits>
44 char* buffer =
nullptr;
57 static constexpr
bool isSerializable()
59 return std::is_base_of<Serializable, T>::value;
98 for (
size_t i = 0; i <
sizeof(T); i++) {
99 reinterpret_cast<char*
>(&obj)[i] = buffer[pos];
Interface for serializing objects.
Definition: Serializable.h:34
std::enable_if<!isSerializable< T >), BufferReader >::type & operator>>(T &obj)
Get an object from the buffer.
Definition: BufferReader.h:96
The ThunderEgg namespace.
Definition: BiLinearGhostFiller.h:31
BufferReader(char *buffer)
Create a new BufferReader with given buffer.
Definition: BufferReader.h:68
int getPos()
get the current position in the buffer
Definition: BufferReader.h:74
BufferReader & operator>>(Serializable &obj)
Get an object of the buffer.
Definition: BufferReader.h:82
virtual int deserialize(char *buffer)=0
Deserialize an object.
Class that is used to help read serialized objects from a buffer.
Definition: BufferReader.h:38