Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/network/synchronizeable.h @ 6259

Last change on this file since 6259 was 6139, checked in by patrick, 19 years ago

trunk: merged branche network with trunk using command: svn merge -r5999:HEAD, conflicts resolved in favor of the trunk bla

File size: 1.5 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
21class NetworkStream;
22
23
24class Synchronizeable : virtual public BaseObject
25  {
26  public:
27
28    Synchronizeable(const char* name);
29    Synchronizeable();
30    ~Synchronizeable();
31
32    virtual void      writeBytes(const byte* data, int length);
33    virtual int       readBytes(byte* data, int maxLength, int * reciever);
34    virtual void      writeDebug() const;
35    virtual void      readDebug() const;
36
37    void setIsServer( bool isServer );
38    void setIsOutOfSync( bool outOfSync );
39    bool isServer();
40    bool isOutOfSync();
41    void setUniqueID( int id ){ uniqueID = id; }
42    int  getUniqueID() const { return uniqueID; };
43    void requestSync( int hostID ){ this->synchronizeRequests.push_back( hostID ); }
44
45    inline int getOwner(){ return owner; }
46    inline void setOwner(int owner){ this->owner = owner; }
47
48    inline void setNetworkStream(NetworkStream* stream) { this->networkStream = stream; }
49
50  private:
51
52    int               uniqueID;
53
54
55
56    //static std::vector<Synchronizeable*> classList;
57    int owner;
58    int hostID;
59    int state;
60    std::list<int> synchronizeRequests;
61
62    NetworkStream* networkStream;
63
64  };
65#endif /* _SYNCHRONIZEABLE_H */
Note: See TracBrowser for help on using the repository browser.