Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/network/Synchronisable.h @ 891

Last change on this file since 891 was 871, checked in by landauf, 16 years ago

merged core branch to trunk

File size: 1.5 KB
RevLine 
[230]1//
2// C++ Interface: synchronisable
3//
[871]4// Description:
[230]5//
6//
7// Author:  Oliver Scheuss, (C) 2007
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
[673]12#ifndef _Synchronisable_H__
13#define _Synchronisable_H__
[230]14
[237]15#include <list>
16
[777]17#include "NetworkPrereqs.h"
[871]18#include "core/OrxonoxClass.h"
[332]19
[777]20namespace network
21{
22  enum variableType{
23    DATA,
24    STRING,
25  };
[230]26
[777]27  struct syncData{
28    int length;
29    int objectID;
30    int classID;
31    unsigned char *data;
32  };
[237]33
[777]34  typedef struct synchronisableVariable{
35    int size;
36    const void *var;
37    variableType type;
38  }SYNCVAR;
[237]39
[230]40
[777]41  /**
42  * This class is the base class of all the Objects in the universe that need to be synchronised over the network
43  * 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.
44  * @author Oliver Scheuss
45  */
46  class _NetworkExport Synchronisable : virtual public orxonox::OrxonoxClass{
47  public:
[230]48
[871]49      virtual ~Synchronisable();
[777]50    int objectID;
51    int classID;
52
53    void registerVar(const void *var, int size, variableType t);
54    //  syncData getData();
55    syncData getData(unsigned char *mem);
56    int getSize();
57    bool updateData(syncData vars);
58    void registerAllVariables();
59    virtual bool create()=0;
60  protected:
61    Synchronisable();
62  private:
63    /*  bool removeObject(Iterator<Synchronisable> it);*/
64
65    std::list<SYNCVAR> syncList;
66    int datasize;
67  };
[230]68}
69
[673]70#endif /* _Synchronisable_H__ */
Note: See TracBrowser for help on using the repository browser.