From c9b9d15a585df8f01b49510e4ff0dfb53ee7b9ef Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Mon, 8 Nov 2010 16:06:22 +0100 Subject: Started on payload classes. --- common/payload.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 common/payload.h (limited to 'common/payload.h') diff --git a/common/payload.h b/common/payload.h new file mode 100644 index 0000000..fbdcd1d --- /dev/null +++ b/common/payload.h @@ -0,0 +1,49 @@ +#ifndef PAYLOAD_H +#define PAYLOAD_H + +#include +#include + +namespace Payload { + namespace Types { + //! Payload types. + enum Type { + Undefined, + Hello, + Login, + LoginResponse, + LobbyStatus, + LobbyAction, + GameStart, + Ready, + RoundStart, + RoundState, + RoundAction, + RoundEnd, + GameEnd + }; + } + using Types::Type; + + class Base { + protected: + friend class Message; + + virtual std::pair serialize() = 0; + + Base(Type t) : type(t) {} + + public: + const Type type; + }; + + class Hello : public Base { + protected: + virtual std::pair serialize(); + + public: + Hello() : Base(Types::Hello) {} + }; +}; + +#endif -- cgit v1.2.3