Changeset 6123 for code/branches/presentation2/src/libraries
- Timestamp:
- Nov 23, 2009, 8:19:58 PM (15 years ago)
- Location:
- code/branches/presentation2/src/libraries
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/libraries/network/synchronisable/CMakeLists.txt
r5781 r6123 10 10 NetworkCallbackManager.h 11 11 Synchronisable.h 12 SynchronisablePointer.h 12 13 SynchronisableVariable.h 13 14 ) -
code/branches/presentation2/src/libraries/network/synchronisable/Synchronisable.h
r5929 r6123 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 //template <class T> void unregisterVariable(T& var);141 140 void setPriority(unsigned int freq){ objectFrequency_ = freq; } 142 141 … … 187 186 if (bidirectional) 188 187 { 189 syncList.push_back(new SynchronisableVariableBidirectional< constT>(variable, mode, cb));188 syncList.push_back(new SynchronisableVariableBidirectional<T>(variable, mode, cb)); 190 189 this->dataSize_ += syncList.back()->getSize(state_); 191 190 } 192 191 else 193 192 { 194 syncList.push_back(new SynchronisableVariable< constT>(variable, mode, cb));193 syncList.push_back(new SynchronisableVariable<T>(variable, mode, cb)); 195 194 if ( this->state_ == mode ) 196 195 this->dataSize_ += syncList.back()->getSize(state_); 197 196 } 198 197 } 199 200 201 202 // template <class T> void Synchronisable::unregisterVariable(T& var){203 // std::vector<SynchronisableVariableBase*>::iterator it = syncList.begin();204 // while(it!=syncList.end()){205 // if( ((*it)->getReference()) == &var ){206 // delete (*it);207 // syncList.erase(it);208 // return;209 // }210 // else211 // it++;212 // }213 // bool unregistered_nonexistent_variable = false;214 // assert(unregistered_nonexistent_variable); //if we reach this point something went wrong:215 // // the variable has not been registered before216 // }217 198 218 199 -
code/branches/presentation2/src/libraries/network/synchronisable/SynchronisableVariable.h
r5781 r6123 35 35 #include <cassert> 36 36 #include <cstring> 37 #include " util/Serialise.h"37 #include "Serialise.h" 38 38 #include "util/TypeTraits.h" 39 39 #include "core/GameMode.h" … … 143 143 if ( this->callback_ != 0 ) 144 144 { 145 if( forceCallback || !checkEquality( this->variable_, mem ) ) 146 callback = true; 145 callback = forceCallback || !checkEquality( this->variable_, mem ); 147 146 } 148 147 // write the data -
code/branches/presentation2/src/libraries/util/Serialise.h
r5738 r6123 40 40 namespace orxonox{ 41 41 42 // general template declaration43 44 42 /** @brief returns the size of the variable in a datastream */ 45 template <class T> inline uint32_t returnSize( const T& );43 template <class T> inline uint32_t returnSize( const T& variable ); 46 44 /** @brief loads the value of a variable out of the bytestream and increases the mem pointer */ 47 template <class T> inline void loadAndIncrease( const T& , uint8_t*&);45 template <class T> inline void loadAndIncrease( const T& variable, uint8_t*& mem ); 48 46 /** @brief saves the value of a variable into the bytestream and increases the mem pointer */ 49 template <class T> inline void saveAndIncrease( const T& , uint8_t*&);47 template <class T> inline void saveAndIncrease( const T& variable, uint8_t*& mem ); 50 48 /** @brief checks whether the variable of type T is the same as in the bytestream */ 51 template <class T> inline bool checkEquality( const T&, uint8_t*);49 template <class T> inline bool checkEquality( const T& variable, uint8_t* mem ); 52 50 53 51 // =================== Template specialisation stuff ============= … … 471 469 return variable==Degree(*r); 472 470 } 473 474 475 471 } 476 472
Note: See TracChangeset
for help on using the changeset viewer.