Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

synchronizeable: added sender parameter to writeBytes
network_stream: creates now a network_game_manager
network_game_manager: implemented some functions

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
[6190]32    virtual void      writeBytes(const byte* data, int length, int sender);
[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
[6190]62  protected:
[6139]63    NetworkStream* networkStream;
64
[5804]65  };
[5548]66#endif /* _SYNCHRONIZEABLE_H */
Note: See TracBrowser for help on using the repository browser.