Changeset 5997 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Dec 9, 2005, 12:41:31 PM (19 years ago)
- Location:
- trunk/src/lib/network
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/network/network_manager.cc
r5996 r5997 49 49 this->syncList = NULL; 50 50 this->tmpStream = NULL; 51 this->hostID = -1; 51 52 52 53 PRINTF(0)("NetworkManager created\n"); … … 165 166 166 167 } 168 169 /** 170 * Sets the hostID to a specific number 171 * @param id: The new ID 172 */ 173 void NetworkManager::setHostID(int id) 174 { 175 this->hostID = id; 176 } -
trunk/src/lib/network/network_manager.h
r5996 r5997 43 43 44 44 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: 46 50 void connectSynchronizeable(Synchronizeable& sync); 47 51 void synchronize(); 48 52 49 50 private:51 53 NetworkManager(); 52 54 … … 57 59 static NetworkManager* singletonRef; //!< Pointer to the only instance of this Class 58 60 NetworkStream* tmpStream; //!< FIXME: this is only for testing purposes 61 int hostID; //!< The Host-ID of the Manager 59 62 60 63 }; -
trunk/src/lib/network/synchronizeable.cc
r5996 r5997 12 12 ### File Specific: 13 13 main-programmer: Silvan Nellen 14 co-programmer: ...14 co-programmer: Benjamin Wuest 15 15 */ 16 16 … … 23 23 */ 24 24 Synchronizeable::Synchronizeable() 25 {} 25 { 26 27 //owner = ?; 28 //hostID = ?; 29 //state = ?; 30 31 } 26 32 27 33 /** … … 59 65 void Synchronizeable::readDebug() const 60 66 {} 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 */ 76 void 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 */ 88 void 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 */ 100 bool 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 */ 109 bool Synchronizeable::isOutOfSync() 110 { 111 return this->state & STATE_OUTOFSYNC == STATE_OUTOFSYNC; 112 } -
trunk/src/lib/network/synchronizeable.h
r5996 r5997 7 7 #define _SYNCHRONIZEABLE_H 8 8 9 #include <base_object.h>9 #include "base_object.h" 10 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 11 21 12 22 class Synchronizeable : virtual public BaseObject … … 22 32 virtual void writeDebug() const; 23 33 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(); 24 43 25 44 private: 26 45 27 46 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; 28 55 29 56 };
Note: See TracChangeset
for help on using the changeset viewer.