Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6695 in orxonox.OLD for trunk/src/lib/network/synchronizeable.h


Ignore:
Timestamp:
Jan 25, 2006, 2:39:53 PM (18 years ago)
Author:
patrick
Message:

merged the network branche to the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/network/synchronizeable.h

    r6341 r6695  
    163163
    164164class Synchronizeable : virtual public BaseObject
    165   {
     165{
     166
    166167  public:
    167168    Synchronizeable();
    168     ~Synchronizeable();
     169    virtual ~Synchronizeable();
    169170
    170171    virtual int       writeBytes(const byte* data, int length, int sender);
     
    179180    bool isOutOfSync();
    180181    bool requestedSync();
     182
    181183    inline void setUniqueID( int id ){ uniqueID = id; }
    182     inline int  getUniqueID() const { return uniqueID; };
     184    inline int  getUniqueID() const { return uniqueID; }
     185    inline int getHostID() { return this->hostID; }
     186
     187    inline int getOwner(){ return owner; }
     188    inline void setOwner(int owner){ this->owner = owner; }
     189
     190    /** @returns true if this Synchronizeable has to be synchronized over network */
     191    inline bool beSynchronized() { return this->bSynchronize; }
     192    /** @param bSynchronize sets the Synchronizeable to be sunchronized or not */
     193    inline void setSynchronized(bool bSynchronize) { this->bSynchronize = bSynchronize; }
     194
    183195    inline void requestSync( int hostID ){ this->synchronizeRequests.push_back( hostID ); }
    184196    inline int getRequestSync( void ){ if ( this->synchronizeRequests.size()>0 ){ int n = *(synchronizeRequests.begin()); synchronizeRequests.pop_front(); return n; } else { return -1; } };
    185     inline int getHostID() { return this->hostID; }
    186 
    187     inline int getOwner(){ return owner; }
    188     inline void setOwner(int owner){ this->owner = owner; }
    189197
    190198    inline void setNetworkStream(NetworkStream* stream) { this->networkStream = stream; }
     199    inline NetworkStream* getNetworkStream() { return this->networkStream; }
     200
     201
     202  protected:
     203    NetworkStream*    networkStream;
     204    int               state;
     205
    191206
    192207  private:
    193 
    194208    int               uniqueID;
    195 
    196 
    197 
    198     //static std::vector<Synchronizeable*> classList;
    199     int owner;
    200     int hostID;
    201 
    202     std::list<int> synchronizeRequests;
    203 
    204   protected:
    205     NetworkStream* networkStream;
    206     int state;
    207 
    208   };
     209    int               owner;
     210    int               hostID;
     211    bool              bSynchronize;
     212
     213    std::list<int>    synchronizeRequests;
     214
     215};
    209216#endif /* _SYNCHRONIZEABLE_H */
Note: See TracChangeset for help on using the changeset viewer.