Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages | Examples

ServerData Class Reference
[GanefServer]

This is the interface implemented by all data residing on the server. When your data-classes inherit from this class they must implement the fillXXX methods. This is how the packets used to update/construct a client version of the object are created. More...

#include <serverdata.h>

Inheritance diagram for ServerData:

FrameworkData List of all members.

Public Member Functions

 ServerData (ServerFramework *f, char packet_priority, bool packet_reliable)
 ~ServerData ()
void sendCreateObjectToAll () const
 Will send a create-object packet to all clients.
void sendCreateObject (const std::map< unsigned int, Client * > &clientlist) const
 Creates and sends a create-object packet to a list of clients.
void sendCreateObject (Client *client) const
void sendUpdateToAll (unsigned char type, bool reliable) const
 Will send an update packet to all clients.
void sendUpdate (const std::map< unsigned int, Client * > &clientlist, unsigned char type, bool reliable) const
 Creates and sends an update packet to a list of clients.
void sendUpdate (Client *client, unsigned char type, bool reliable) const
void sendDestroyToAll () const
 Will send a destroy/delete-object packet to all clients.
void sendDestroy (const std::map< unsigned int, Client * > &clientlist) const
 Create and sends a destroy-object packet to a list of clients.
void sendDestroy (Client *client) const
virtual const unsigned int getClassId () const =0
 This must produce a unique id for this class, it will be used on the client side to construct new objects.
virtual void fillUpdatePacket (ServerPacket *packet, unsigned char type) const =0
 Here the data-class should fill in data according to update type `type`.
virtual void fillCreateObjectPacket (ServerPacket *packet) const =0
 Here the data-class should fill in all data required by the constructor on the client side.
virtual void clientPacket (Client *client, unsigned char type, ServerPacket *packet)=0
 Called when ever we receive a packet for this object from a client.

Detailed Description

This is the interface implemented by all data residing on the server. When your data-classes inherit from this class they must implement the fillXXX methods. This is how the packets used to update/construct a client version of the object are created.

OPTIMIZE: we could enqueue the packet directly if there is only one receiver in the client-list

Author:
Lars Langer & Emanuel Greisen
Examples:

testserver/testserversnakebite.cpp, and testserver/testserversnakebite.h.

Definition at line 49 of file serverdata.h.


The documentation for this class was generated from the following files:
Generated on Mon Feb 6 12:24:53 2006 for Ganef by  doxygen 1.4.4