Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/merger/src/network/Synchronisable.h @ 310

Last change on this file since 310 was 278, checked in by nicolasc, 17 years ago

merged network

File size: 1.2 KB
RevLine 
[230]1//
2// C++ Interface: synchronisable
3//
4// Description:
5//
6//
7// Author:  Oliver Scheuss, (C) 2007
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
[247]12#ifndef NETWORK_SYNCHRONISABLE_H
13#define NETWORK_SYNCHRONISABLE_H
[230]14
[237]15#include <list>
16
[230]17namespace network {
18
[237]19 
20struct syncData{
21  int length;
22  int classID;
23  int objectID;
24  unsigned char *data;
25};
26
27typedef struct synchronisableVariable{
28  int size;
29  const void *var;
30}SYNCVAR;
31
32 
[230]33/**
34 * This class is the base class of all the Objects in the universe that need to be synchronised over the network
35 * Every class, that inherits from this class has to link the DATA THAT NEEDS TO BE SYNCHRONISED into the linked list. Additionally it also has to provide a Constructor, that takes exactly the variables in this linked list.
36 * @author Oliver Scheuss
37*/
38class Synchronisable{
39public:
[237]40  Synchronisable();
[230]41
[237]42  ~Synchronisable();
43  int objectID;
44  int classID;
45   
46  void registerVar(const void *var, int size);
47  syncData getData();
[247]48  syncData getData(unsigned char *mem);
49  int getSize();
[237]50  bool updateData(syncData vars);
51  virtual void registerAllVariables();
[230]52
[237]53private:
54  std::list<SYNCVAR> syncList;
[247]55  int datasize;
[230]56};
57
58}
59
60#endif
Note: See TracBrowser for help on using the repository browser.