- Timestamp:
- Dec 21, 2009, 1:18:36 PM (15 years ago)
- Location:
- code/branches/presentation2/src/libraries/network/synchronisable
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/libraries/network/synchronisable/NetworkCallback.h
r6192 r6387 36 36 37 37 namespace orxonox{ 38 38 39 39 struct EmptyType{}; 40 40 41 41 class _NetworkExport NetworkCallbackBase 42 42 { … … 60 60 void (T::*function_) (void); 61 61 }; 62 62 63 63 template <class T, class U> 64 64 class NetworkCallbackNotify: public NetworkCallbackBase -
code/branches/presentation2/src/libraries/network/synchronisable/NetworkCallbackManager.cc
r5781 r6387 26 26 * 27 27 */ 28 28 29 29 #include "NetworkCallbackManager.h" 30 30 #include "NetworkCallback.h" 31 31 32 32 namespace orxonox{ 33 33 34 34 std::set<NetworkCallbackBase*> NetworkCallbackManager::callbackSet_; 35 35 std::queue<NetworkCallbackBase*> NetworkCallbackManager::triggeredCallbacks_; 36 36 37 37 void NetworkCallbackManager::registerCallback(NetworkCallbackBase *cb) 38 38 { … … 48 48 } 49 49 } 50 50 51 51 void NetworkCallbackManager::triggerCallback(NetworkCallbackBase *cb) 52 52 { -
code/branches/presentation2/src/libraries/network/synchronisable/NetworkCallbackManager.h
r5781 r6387 37 37 38 38 namespace orxonox{ 39 39 40 40 class _NetworkExport NetworkCallbackManager{ 41 41 public: … … 48 48 static std::queue<NetworkCallbackBase*> triggeredCallbacks_; 49 49 }; 50 50 51 51 52 52 } -
code/branches/presentation2/src/libraries/network/synchronisable/Synchronisable.cc
r6192 r6387 62 62 } 63 63 classID_ = static_cast<uint32_t>(-1); 64 64 65 65 // set dataSize to 0 66 66 this->dataSize_ = 0; … … 277 277 //tempsize += (*i)->getSize( mode ); 278 278 } 279 279 280 280 tempsize += SynchronisableHeader::getSize(); 281 281 header.setObjectID( this->objectID_ ); … … 284 284 header.setDataAvailable( true ); 285 285 header.setDataSize( tempsize ); 286 286 287 287 #ifndef NDEBUG 288 288 uint32_t size; -
code/branches/presentation2/src/libraries/network/synchronisable/Synchronisable.h
r6193 r6387 132 132 inline unsigned int getPriority() const { return this->objectFrequency_;} 133 133 inline uint8_t getSyncMode() const { return this->objectMode_; } 134 134 135 135 void setSyncMode(uint8_t mode); 136 136 … … 138 138 Synchronisable(BaseObject* creator); 139 139 template <class T> void registerVariable(T& variable, uint8_t mode=0x1, NetworkCallbackBase *cb=0, bool bidirectional=false); 140 140 141 141 void setPriority(unsigned int freq){ objectFrequency_ = freq; } 142 142 … … 148 148 bool isMyData(uint8_t* mem); 149 149 bool doSync(int32_t id, uint8_t mode=0x0); 150 150 151 151 inline void setObjectID(uint32_t id){ this->objectID_ = id; objectMap_[this->objectID_] = this; } 152 152 inline void setClassID(uint32_t id){ this->classID_ = id; } … … 181 181 } 182 182 } 183 183 184 184 template <> _NetworkExport void Synchronisable::registerVariable( std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional); 185 185 186 186 187 187 } 188 188 -
code/branches/presentation2/src/libraries/network/synchronisable/SynchronisableVariable.h
r6192 r6387 41 41 42 42 namespace orxonox{ 43 43 44 44 namespace VariableDirection{ 45 45 enum Value{ … … 54 54 }; 55 55 } 56 56 57 57 class _NetworkExport SynchronisableVariableBase 58 58 { … … 85 85 NetworkCallbackBase *callback_; 86 86 }; 87 87 88 88 template <class T> 89 89 class SynchronisableVariableBidirectional: public SynchronisableVariable<T> … … 92 92 SynchronisableVariableBidirectional(T& variable, uint8_t master=Bidirectionality::ServerMaster, NetworkCallbackBase *cb=0); 93 93 virtual ~SynchronisableVariableBidirectional(); 94 94 95 95 virtual inline uint8_t getMode(){ return 0x3; } //this basically is a hack ^^ 96 96 virtual inline uint32_t getData(uint8_t*& mem, uint8_t mode); … … 112 112 } 113 113 } 114 114 115 115 template <class T> SynchronisableVariable<T>::~SynchronisableVariable() 116 116 { … … 253 253 return returnSize( this->variable_ ) + sizeof(varReference_); 254 254 } 255 255 256 256 257 257 }
Note: See TracChangeset
for help on using the changeset viewer.