Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 374 was 346, checked in by rgrieder, 17 years ago
  • adjusted the entire source to compile under windows visual studio too:
  • added some ugly conversions
  • changed some illegal code pieces (gcc however accepted it)
  • added a few files from reto's framework to evade linker errors (no more dynamic linking)
  • inserted some 'return true' to justify the return type
  • excluded the levelLoader in the orxonox.cc (couldn't make it work, parsing error)
  • wrote about 5 code #branches to compensate for missing usleep() under windows
File size: 1.3 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>
[237]17
[332]18#include "orxonox/core/IdentifierIncludes.h"
19
[230]20namespace network {
21
[237]22 
23struct syncData{
24  int length;
[332]25  int objectID;
[237]26  int classID;
27  unsigned char *data;
28};
29
30typedef struct synchronisableVariable{
31  int size;
32  const void *var;
33}SYNCVAR;
34
35 
[230]36/**
37 * This class is the base class of all the Objects in the universe that need to be synchronised over the network
38 * 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.
39 * @author Oliver Scheuss
40*/
41class Synchronisable{
42public:
[237]43  Synchronisable();
[230]44
[332]45  virtual ~Synchronisable();
[237]46  int objectID;
47  int classID;
48   
49  void registerVar(const void *var, int size);
50  syncData getData();
[247]51  syncData getData(unsigned char *mem);
52  int getSize();
[237]53  bool updateData(syncData vars);
[346]54  virtual void registerAllVariables() = 0;
[230]55
[237]56private:
[332]57/*  bool removeObject(Iterator<Synchronisable> it);*/
58 
[237]59  std::list<SYNCVAR> syncList;
[247]60  int datasize;
[230]61};
62
63}
64
65#endif
Note: See TracBrowser for help on using the repository browser.