Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 1306 was 780, checked in by rgrieder, 17 years ago
  • once again
File size: 1.7 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//
[673]12#ifndef _Synchronisable_H__
13#define _Synchronisable_H__
[230]14
[237]15#include <list>
16
[777]17#include "NetworkPrereqs.h"
[774]18#include "core/CoreIncludes.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
[777]49    virtual ~Synchronisable();
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  };
68
[230]69}
70
[780]71namespace orxonox
72{
73  template class _NetworkExport ClassIdentifier<network::Synchronisable>;
74  template class _NetworkExport ObjectList<network::Synchronisable>;
75}
76
[673]77#endif /* _Synchronisable_H__ */
Note: See TracBrowser for help on using the repository browser.