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
RevLine 
[5523]1/*!
2 * @file connection_monitor.h
[5550]3    \brief interface for all classes that have to be synchronized
[5547]4 */
[5523]5
[5547]6#ifndef _SYNCHRONIZEABLE_H
7#define _SYNCHRONIZEABLE_H
[5523]8
[5997]9#include "base_object.h"
[5547]10#include "netdefs.h"
11
[5997]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
[6139]21class NetworkStream;
[5997]22
[6139]23
[5581]24class Synchronizeable : virtual public BaseObject
[5804]25  {
26  public:
[5523]27
[5804]28    Synchronizeable(const char* name);
[5996]29    Synchronizeable();
[5804]30    ~Synchronizeable();
[5523]31
[5806]32    virtual void      writeBytes(const byte* data, int length);
[6139]33    virtual int       readBytes(byte* data, int maxLength, int * reciever);
[5806]34    virtual void      writeDebug() const;
35    virtual void      readDebug() const;
[6139]36
37    void setIsServer( bool isServer );
38    void setIsOutOfSync( bool outOfSync );
[5997]39    bool isServer();
40    bool isOutOfSync();
[6139]41    void setUniqueID( int id ){ uniqueID = id; }
42    int  getUniqueID() const { return uniqueID; };
43    void requestSync( int hostID ){ this->synchronizeRequests.push_back( hostID ); }
[5547]44
[6139]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
[5804]50  private:
[5523]51
[5804]52    int               uniqueID;
[6139]53
54
55
[5997]56    //static std::vector<Synchronizeable*> classList;
57    int owner;
58    int hostID;
59    int state;
60    std::list<int> synchronizeRequests;
[5547]61
[6139]62    NetworkStream* networkStream;
63
[5804]64  };
[5548]65#endif /* _SYNCHRONIZEABLE_H */
Note: See TracBrowser for help on using the repository browser.