Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5997 in orxonox.OLD


Ignore:
Timestamp:
Dec 9, 2005, 12:41:31 PM (18 years ago)
Author:
patrick
Message:

merged the network branche a second time because there where some more changes in the code: svn merge -r5991:HEAD branches/network trunk

Location:
trunk/src/lib/network
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/network/network_manager.cc

    r5996 r5997  
    4949  this->syncList = NULL;
    5050  this->tmpStream = NULL;
     51  this->hostID = -1;
    5152
    5253  PRINTF(0)("NetworkManager created\n");
     
    165166
    166167}
     168
     169/**
     170 * Sets the hostID to a specific number
     171 * @param id: The new ID
     172 */
     173void NetworkManager::setHostID(int id)
     174{
     175  this->hostID = id;
     176}
  • trunk/src/lib/network/network_manager.h

    r5996 r5997  
    4343
    4444
    45 private:
     45    void setHostID(int id);
     46    /** Returns the hostID @return The hostID of the object */
     47    inline int getHostID() { return this->hostID; };
     48
     49  private:
    4650    void connectSynchronizeable(Synchronizeable& sync);
    4751    void synchronize();
    4852
    49 
    50   private:
    5153    NetworkManager();
    5254
     
    5759    static NetworkManager* singletonRef;           //!< Pointer to the only instance of this Class
    5860    NetworkStream*         tmpStream;              //!< FIXME: this is only for testing purposes
     61    int hostID;                                    //!< The Host-ID of the Manager
    5962
    6063};
  • trunk/src/lib/network/synchronizeable.cc

    r5996 r5997  
    1212### File Specific:
    1313   main-programmer: Silvan Nellen
    14    co-programmer: ...
     14   co-programmer: Benjamin Wuest
    1515*/
    1616
     
    2323 */
    2424Synchronizeable::Synchronizeable()
    25 {}
     25{
     26
     27  //owner = ?;
     28  //hostID = ?;
     29  //state = ?;
     30
     31}
    2632
    2733/**
     
    5965void Synchronizeable::readDebug() const
    6066{}
     67
     68
     69
     70
     71
     72/**
     73 * Sets the server flag to a given value
     74 * @param isServer: the boolean value which the server flag is to set to
     75 */
     76void Synchronizeable::setIsServer(bool isServer)
     77{
     78  if( isServer )
     79    this->state = this->state | STATE_SERVER;
     80  else
     81    this->state = this->state & (~STATE_SERVER);
     82}
     83
     84/**
     85 * Sets the outofsync flag to a given value
     86 * @param outOfSync: the boolean value which the outofsync flag is to set to
     87 */
     88void Synchronizeable::setIsOutOfSync(bool outOfSync)
     89{
     90  if( outOfSync )
     91    this->state = this->state | STATE_OUTOFSYNC;
     92  else
     93    this->state = this->state & (~STATE_OUTOFSYNC);
     94}
     95
     96/**
     97 * Determines if the server flag is set
     98 * @return true, if the server flag is true, false else
     99 */
     100bool Synchronizeable::isServer()
     101{
     102  return this->state & STATE_SERVER == STATE_SERVER;
     103}
     104
     105/**
     106 * Determines if the outofsync flag is set
     107 * @return true, if the outofsync flag is true, false else
     108 */
     109bool Synchronizeable::isOutOfSync()
     110{
     111  return this->state & STATE_OUTOFSYNC == STATE_OUTOFSYNC;
     112}
  • trunk/src/lib/network/synchronizeable.h

    r5996 r5997  
    77#define _SYNCHRONIZEABLE_H
    88
    9 #include <base_object.h>
     9#include "base_object.h"
    1010#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
    1121
    1222class Synchronizeable : virtual public BaseObject
     
    2232    virtual void      writeDebug() const;
    2333    virtual void      readDebug() const;
     34   
     35   
     36   
     37   
     38   
     39    void setIsServer(bool isServer);
     40    void setIsOutOfSync(bool outOfSync);
     41    bool isServer();
     42    bool isOutOfSync();
    2443
    2544  private:
    2645
    2746    int               uniqueID;
     47   
     48   
     49   
     50    //static std::vector<Synchronizeable*> classList;
     51    int owner;
     52    int hostID;
     53    int state;
     54    std::list<int> synchronizeRequests;
    2855
    2956  };
Note: See TracChangeset for help on using the changeset viewer.