#include "tools.hh"#include "EventProcess.hh"Include dependency graph for PacketHandler.hh:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Classes | |
| class | BasePacketHandler |
| Base packet handler. More... | |
| class | PacketHandler< N, T > |
| Packet Handler. More... | |
Defines | |
| #define | DECLARE_PACKET(Cst, PClass) |
| Declare a structure for a packet. | |
| #define | define |
| #define | HANDLE_WITH(Token, Class, Object, Method, When) handleWith(new PacketHandler<Token, Class>(Object, &Class::Method), When) |
| Declare a Packet without additional attributes. | |
| #define DECLARE_PACKET | ( | Cst, | |||
| PClass | ) |
Value:
struct PClass; \ template <typename T> \ class PacketHandler<Cst, T> : public BasePacketHandler \ { \ public: \ typedef void (T::*fct_t)(const PClass*); \ PacketHandler<Cst, T>(T* obj, fct_t f) \ : obj_(obj), f_(f) {} \ virtual void handle(const Packet* p) \ { \ LOG5("<- `" #Cst "' (id: %1)", \ p->client_id); \ (obj_->*f_)(reinterpret_cast<const PClass*>(p)); \ } \ virtual int getCstValue() const { return Cst; } \ virtual void dispatchUIEvent(const EventProcess* evp, \ const Packet& pkt) \ { \ evp->dispatch(reinterpret_cast<const PClass&>(pkt)); \ } \ private: \ T* obj_; \ fct_t f_; \ }; \ struct PClass : public Packet \ { \ PClass(int client_id = -1) \ : Packet(Cst, client_id) { data_size = sizeof(*this); }
| Cst | One message constant, as defined in Constants.hh. | |
| PClass | The struct name, derived from Packet, to create. |
DECLARE_PACKET(MSG_BALLPOS, MsgBallPos) int row; int col; };
| #define define |
Value:
DECLARE_EMPTY_PACKET(Cst, PClass) \ DECLARE_PACKET(Cst, PClass) \ };
1.4.7