Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FICN/src/network/Synchronisable.h @ 571

Last change on this file since 571 was 571, checked in by scheusso, 16 years ago

cmakelists

File size: 1.5 KB
Line 
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//
12#ifndef NETWORK_SYNCHRONISABLE_H
13#define NETWORK_SYNCHRONISABLE_H
14
15#include <list>
16#include <iostream>
17#include <string>
18
19#include "orxonox/core/CoreIncludes.h"
20#include "orxonox/core/OrxonoxClass.h"
21
22namespace network {
23
24enum variableType{
25  DATA,
26  STRING,
27};
28 
29struct syncData{
30  int length;
31  int objectID;
32  int classID;
33  unsigned char *data;
34};
35
36typedef struct synchronisableVariable{
37  int size;
38  const void *var;
39  variableType type;
40}SYNCVAR;
41
42 
43/**
44 * This class is the base class of all the Objects in the universe that need to be synchronised over the network
45 * 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.
46 * @author Oliver Scheuss
47*/
48class Synchronisable : virtual public orxonox::OrxonoxClass{
49public:
50
51  virtual ~Synchronisable();
52  int objectID;
53  int classID;
54   
55  void registerVar(const void *var, int size, variableType t);
56//  syncData getData();
57  syncData getData(unsigned char *mem);
58  int getSize();
59  bool updateData(syncData vars);
60  virtual void registerAllVariables()=0;
61  virtual bool create(){return true;}
62protected:
63  Synchronisable();
64private:
65/*  bool removeObject(Iterator<Synchronisable> it);*/
66 
67  std::list<SYNCVAR> syncList;
68  int datasize;
69};
70
71}
72
73#endif
Note: See TracBrowser for help on using the repository browser.