Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/network/synchronizeable.h @ 6053

Last change on this file since 6053 was 6053, checked in by rennerc, 18 years ago

handshake works now

File size: 1.3 KB
Line 
1/*!
2 * @file connection_monitor.h
3    \brief interface for all classes that have to be synchronized
4 */
5
6#ifndef _SYNCHRONIZEABLE_H
7#define _SYNCHRONIZEABLE_H
8
9#include "base_object.h"
10#include "netdefs.h"
11
12
13
14#include <vector>
15#include <list>
16
17//State constants: They have to be of the form 2^n
18#define STATE_SERVER 1
19#define STATE_OUTOFSYNC 2
20
21
22class Synchronizeable : virtual public BaseObject
23  {
24  public:
25
26    Synchronizeable(const char* name);
27    Synchronizeable();
28    ~Synchronizeable();
29
30    virtual void      writeBytes(const byte* data, int length);
31    virtual int       readBytes(byte* data, int maxLength, int * reciever);
32    virtual void      writeDebug() const;
33    virtual void      readDebug() const;
34
35    void setIsServer( bool isServer );
36    void setIsOutOfSync( bool outOfSync );
37    bool isServer();
38    bool isOutOfSync();
39    void setUniqueId( int id ){ uniqueID = id; }
40    int  getUniqueID() const { return uniqueID; };
41    void requestSync( int hostID ){ this->synchronizeRequests.push_back( hostID ); }
42
43    inline int getOwner(){ return owner; }
44    inline void setOwner(int owner){ this->owner = owner; }
45
46  private:
47
48    int               uniqueID;
49
50
51
52    //static std::vector<Synchronizeable*> classList;
53    int owner;
54    int hostID;
55    int state;
56    std::list<int> synchronizeRequests;
57
58  };
59#endif /* _SYNCHRONIZEABLE_H */
Note: See TracBrowser for help on using the repository browser.