Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

cmakelists

File size: 1.5 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>
[332]16#include <iostream>
[565]17#include <string>
[237]18
[496]19#include "orxonox/core/CoreIncludes.h"
[459]20#include "orxonox/core/OrxonoxClass.h"
[332]21
[230]22namespace network {
23
[565]24enum variableType{
25  DATA,
26  STRING,
27};
[237]28 
29struct syncData{
30  int length;
[332]31  int objectID;
[237]32  int classID;
33  unsigned char *data;
34};
35
36typedef struct synchronisableVariable{
37  int size;
38  const void *var;
[565]39  variableType type;
[237]40}SYNCVAR;
41
42 
[230]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*/
[565]48class Synchronisable : virtual public orxonox::OrxonoxClass{
[230]49public:
50
[332]51  virtual ~Synchronisable();
[237]52  int objectID;
53  int classID;
54   
[565]55  void registerVar(const void *var, int size, variableType t);
[571]56//  syncData getData();
[247]57  syncData getData(unsigned char *mem);
58  int getSize();
[237]59  bool updateData(syncData vars);
[565]60  virtual void registerAllVariables()=0;
61  virtual bool create(){return true;}
62protected:
63  Synchronisable();
[237]64private:
[332]65/*  bool removeObject(Iterator<Synchronisable> it);*/
66 
[237]67  std::list<SYNCVAR> syncList;
[247]68  int datasize;
[230]69};
70
71}
72
73#endif
Note: See TracBrowser for help on using the repository browser.