Changeset 2861 for code/branches/netp2/src/network
- Timestamp:
- Mar 28, 2009, 11:19:06 PM (16 years ago)
- Location:
- code/branches/netp2/src/network/synchronisable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/netp2/src/network/synchronisable/SynchronisableSpecialisations.cc
r2836 r2861 71 71 registerVariable(variable.y, mode, cb, bidirectional); 72 72 } 73 template <> void Synchronisable::registerVariable( Vector2& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional)74 {75 registerVariable( (const ColourValue&)variable, mode, cb, bidirectional);76 }73 // template <> void Synchronisable::registerVariable( Vector2& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) 74 // { 75 // registerVariable( (const ColourValue&)variable, mode, cb, bidirectional); 76 // } 77 77 78 78 template <> void Synchronisable::registerVariable( const Vector3& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) -
code/branches/netp2/src/network/synchronisable/SynchronisableVariable.h
r2836 r2861 21 21 * 22 22 * Author: 23 * Oliver Scheuss , (C) 200823 * Oliver Scheuss 24 24 * Co-authors: 25 25 * ... … … 35 35 #include <string> 36 36 #include <cassert> 37 #include "util/Serialise.h" 37 38 #include "core/Core.h" 38 39 #include "core/CoreIncludes.h" … … 79 80 virtual inline void* getReference(){ return (void *)&this->variable_; } 80 81 protected: 81 inline bool checkEquality(uint8_t* mem);82 inline void setAndIncrease(uint8_t*& mem);83 inline void getAndIncrease(uint8_t*& mem);84 inline uint32_t returnSize();82 // inline bool checkEquality(uint8_t* mem); 83 // inline void loadAndIncrease(uint8_t*& mem); 84 // inline void saveAndIncrease(uint8_t*& mem); 85 // inline uint32_t returnSize(); 85 86 86 87 T& variable_; … … 126 127 if ( state_ == this->mode_ ) 127 128 { 128 getAndIncrease(mem );129 return returnSize( );129 saveAndIncrease( this->variable_, mem ); 130 return returnSize( this->variable_ ); 130 131 } 131 132 else … … 143 144 if ( this->callback_ != 0 ) 144 145 { 145 if( forceCallback || !checkEquality( mem ) )146 if( forceCallback || !checkEquality( this->variable_, mem ) ) 146 147 callback = true; 147 148 } 148 149 // write the data 149 setAndIncrease(mem );150 loadAndIncrease( this->variable_, mem ); 150 151 // now do a callback if neccessary 151 152 if ( callback ) … … 156 157 { 157 158 if ( mode == this->mode_ ) 158 return returnSize( );159 return returnSize( this->variable_ ); 159 160 else 160 161 return 0; 161 162 } 162 163 163 template <> _NetworkExport uint32_t SynchronisableVariable<const bool>::returnSize();164 template <> _NetworkExport void SynchronisableVariable<const bool>:: setAndIncrease(uint8_t*& mem);165 template <> _NetworkExport void SynchronisableVariable<const bool>:: getAndIncrease(uint8_t*& mem);164 /*template <> _NetworkExport uint32_t SynchronisableVariable<const bool>::returnSize(); 165 template <> _NetworkExport void SynchronisableVariable<const bool>::loadAndIncrease(uint8_t*& mem); 166 template <> _NetworkExport void SynchronisableVariable<const bool>::saveAndIncrease(uint8_t*& mem); 166 167 template <> _NetworkExport bool SynchronisableVariable<const bool>::checkEquality(uint8_t* mem); 167 168 template <> _NetworkExport uint32_t SynchronisableVariable<const unsigned char>::returnSize(); 168 template <> _NetworkExport void SynchronisableVariable<const unsigned char>:: setAndIncrease(uint8_t*& mem);169 template <> _NetworkExport void SynchronisableVariable<const unsigned char>:: getAndIncrease(uint8_t*& mem);169 template <> _NetworkExport void SynchronisableVariable<const unsigned char>::loadAndIncrease(uint8_t*& mem); 170 template <> _NetworkExport void SynchronisableVariable<const unsigned char>::saveAndIncrease(uint8_t*& mem); 170 171 template <> _NetworkExport bool SynchronisableVariable<const unsigned char>::checkEquality(uint8_t* mem); 171 172 template <> _NetworkExport uint32_t SynchronisableVariable<const short>::returnSize(); 172 template <> _NetworkExport void SynchronisableVariable<const short>:: setAndIncrease(uint8_t*& mem);173 template <> _NetworkExport void SynchronisableVariable<const short>:: getAndIncrease(uint8_t*& mem);173 template <> _NetworkExport void SynchronisableVariable<const short>::loadAndIncrease(uint8_t*& mem); 174 template <> _NetworkExport void SynchronisableVariable<const short>::saveAndIncrease(uint8_t*& mem); 174 175 template <> _NetworkExport bool SynchronisableVariable<const short>::checkEquality(uint8_t* mem); 175 176 template <> _NetworkExport uint32_t SynchronisableVariable<const unsigned short>::returnSize(); 176 template <> _NetworkExport void SynchronisableVariable<const unsigned short>:: setAndIncrease(uint8_t*& mem);177 template <> _NetworkExport void SynchronisableVariable<const unsigned short>:: getAndIncrease(uint8_t*& mem);177 template <> _NetworkExport void SynchronisableVariable<const unsigned short>::loadAndIncrease(uint8_t*& mem); 178 template <> _NetworkExport void SynchronisableVariable<const unsigned short>::saveAndIncrease(uint8_t*& mem); 178 179 template <> _NetworkExport bool SynchronisableVariable<const unsigned short>::checkEquality(uint8_t* mem); 179 180 template <> _NetworkExport uint32_t SynchronisableVariable<const int>::returnSize(); 180 template <> _NetworkExport void SynchronisableVariable<const int>:: setAndIncrease(uint8_t*& mem);181 template <> _NetworkExport void SynchronisableVariable<const int>:: getAndIncrease(uint8_t*& mem);181 template <> _NetworkExport void SynchronisableVariable<const int>::loadAndIncrease(uint8_t*& mem); 182 template <> _NetworkExport void SynchronisableVariable<const int>::saveAndIncrease(uint8_t*& mem); 182 183 template <> _NetworkExport bool SynchronisableVariable<const int>::checkEquality(uint8_t* mem); 183 184 template <> _NetworkExport uint32_t SynchronisableVariable<const unsigned int>::returnSize(); 184 template <> _NetworkExport void SynchronisableVariable<const unsigned int>:: setAndIncrease(uint8_t*& mem);185 template <> _NetworkExport void SynchronisableVariable<const unsigned int>:: getAndIncrease(uint8_t*& mem);185 template <> _NetworkExport void SynchronisableVariable<const unsigned int>::loadAndIncrease(uint8_t*& mem); 186 template <> _NetworkExport void SynchronisableVariable<const unsigned int>::saveAndIncrease(uint8_t*& mem); 186 187 template <> _NetworkExport bool SynchronisableVariable<const unsigned int>::checkEquality(uint8_t* mem); 187 188 template <> _NetworkExport uint32_t SynchronisableVariable<const long>::returnSize(); 188 template <> _NetworkExport void SynchronisableVariable<const long>:: setAndIncrease(uint8_t*& mem);189 template <> _NetworkExport void SynchronisableVariable<const long>:: getAndIncrease(uint8_t*& mem);189 template <> _NetworkExport void SynchronisableVariable<const long>::loadAndIncrease(uint8_t*& mem); 190 template <> _NetworkExport void SynchronisableVariable<const long>::saveAndIncrease(uint8_t*& mem); 190 191 template <> _NetworkExport bool SynchronisableVariable<const long>::checkEquality(uint8_t* mem); 191 192 template <> _NetworkExport uint32_t SynchronisableVariable<const unsigned long>::returnSize(); 192 template <> _NetworkExport void SynchronisableVariable<const unsigned long>:: setAndIncrease(uint8_t*& mem);193 template <> _NetworkExport void SynchronisableVariable<const unsigned long>:: getAndIncrease(uint8_t*& mem);193 template <> _NetworkExport void SynchronisableVariable<const unsigned long>::loadAndIncrease(uint8_t*& mem); 194 template <> _NetworkExport void SynchronisableVariable<const unsigned long>::saveAndIncrease(uint8_t*& mem); 194 195 template <> _NetworkExport bool SynchronisableVariable<const unsigned long>::checkEquality(uint8_t* mem); 195 196 template <> _NetworkExport uint32_t SynchronisableVariable<const long long>::returnSize(); 196 template <> _NetworkExport void SynchronisableVariable<const long long>:: setAndIncrease(uint8_t*& mem);197 template <> _NetworkExport void SynchronisableVariable<const long long>:: getAndIncrease(uint8_t*& mem);197 template <> _NetworkExport void SynchronisableVariable<const long long>::loadAndIncrease(uint8_t*& mem); 198 template <> _NetworkExport void SynchronisableVariable<const long long>::saveAndIncrease(uint8_t*& mem); 198 199 template <> _NetworkExport bool SynchronisableVariable<const long long>::checkEquality(uint8_t* mem); 199 200 template <> _NetworkExport uint32_t SynchronisableVariable<const unsigned long long>::returnSize(); 200 template <> _NetworkExport void SynchronisableVariable<const unsigned long long>:: setAndIncrease(uint8_t*& mem);201 template <> _NetworkExport void SynchronisableVariable<const unsigned long long>:: getAndIncrease(uint8_t*& mem);201 template <> _NetworkExport void SynchronisableVariable<const unsigned long long>::loadAndIncrease(uint8_t*& mem); 202 template <> _NetworkExport void SynchronisableVariable<const unsigned long long>::saveAndIncrease(uint8_t*& mem); 202 203 template <> _NetworkExport bool SynchronisableVariable<const unsigned long long>::checkEquality(uint8_t* mem); 203 204 template <> _NetworkExport uint32_t SynchronisableVariable<const float>::returnSize(); 204 template <> _NetworkExport void SynchronisableVariable<const float>:: setAndIncrease(uint8_t*& mem);205 template <> _NetworkExport void SynchronisableVariable<const float>:: getAndIncrease(uint8_t*& mem);205 template <> _NetworkExport void SynchronisableVariable<const float>::loadAndIncrease(uint8_t*& mem); 206 template <> _NetworkExport void SynchronisableVariable<const float>::saveAndIncrease(uint8_t*& mem); 206 207 template <> _NetworkExport bool SynchronisableVariable<const float>::checkEquality(uint8_t* mem); 207 208 template <> _NetworkExport uint32_t SynchronisableVariable<const double>::returnSize(); 208 template <> _NetworkExport void SynchronisableVariable<const double>:: setAndIncrease(uint8_t*& mem);209 template <> _NetworkExport void SynchronisableVariable<const double>:: getAndIncrease(uint8_t*& mem);209 template <> _NetworkExport void SynchronisableVariable<const double>::loadAndIncrease(uint8_t*& mem); 210 template <> _NetworkExport void SynchronisableVariable<const double>::saveAndIncrease(uint8_t*& mem); 210 211 template <> _NetworkExport bool SynchronisableVariable<const double>::checkEquality(uint8_t* mem); 211 212 template <> _NetworkExport uint32_t SynchronisableVariable<const long double>::returnSize(); 212 template <> _NetworkExport void SynchronisableVariable<const long double>:: setAndIncrease(uint8_t*& mem);213 template <> _NetworkExport void SynchronisableVariable<const long double>:: getAndIncrease(uint8_t*& mem);213 template <> _NetworkExport void SynchronisableVariable<const long double>::loadAndIncrease(uint8_t*& mem); 214 template <> _NetworkExport void SynchronisableVariable<const long double>::saveAndIncrease(uint8_t*& mem); 214 215 template <> _NetworkExport bool SynchronisableVariable<const long double>::checkEquality(uint8_t* mem); 215 216 template <> _NetworkExport uint32_t SynchronisableVariable<const std::string>::returnSize(); 216 template <> _NetworkExport void SynchronisableVariable<const std::string>:: setAndIncrease(uint8_t*& mem);217 template <> _NetworkExport void SynchronisableVariable<const std::string>:: getAndIncrease(uint8_t*& mem);217 template <> _NetworkExport void SynchronisableVariable<const std::string>::loadAndIncrease(uint8_t*& mem); 218 template <> _NetworkExport void SynchronisableVariable<const std::string>::saveAndIncrease(uint8_t*& mem); 218 219 template <> _NetworkExport bool SynchronisableVariable<const std::string>::checkEquality(uint8_t* mem); 219 220 template <> _NetworkExport uint32_t SynchronisableVariable<const Degree>::returnSize(); 220 template <> _NetworkExport void SynchronisableVariable<const Degree>:: setAndIncrease(uint8_t*& mem);221 template <> _NetworkExport void SynchronisableVariable<const Degree>:: getAndIncrease(uint8_t*& mem);222 template <> _NetworkExport bool SynchronisableVariable<const Degree>::checkEquality(uint8_t* mem); 221 template <> _NetworkExport void SynchronisableVariable<const Degree>::loadAndIncrease(uint8_t*& mem); 222 template <> _NetworkExport void SynchronisableVariable<const Degree>::saveAndIncrease(uint8_t*& mem); 223 template <> _NetworkExport bool SynchronisableVariable<const Degree>::checkEquality(uint8_t* mem);*/ 223 224 224 225 … … 249 250 mem += sizeof(this->varReference_); 250 251 // now write the content 251 SynchronisableVariable<T>::getAndIncrease(mem );252 saveAndIncrease( this->variable_, mem ); 252 253 // mem += SynchronisableVariable<T>::getSize(); 253 254 return SynchronisableVariableBidirectional::getSize(mode); … … 268 269 // apply data 269 270 mem += sizeof(varReference_); 270 if ( SynchronisableVariableBidirectional<T>::checkEquality(mem )==true )271 if ( checkEquality( this->variable_, mem )==true ) 271 272 { 272 mem += SynchronisableVariable<T>::getSize( mode );273 mem += getSize( mode ); 273 274 return; 274 275 } … … 292 293 this->varReference_ = *static_cast<uint8_t*>(mem); 293 294 mem += sizeof(varReference_); 294 if ( SynchronisableVariable<T>::checkEquality(mem ) == false )295 if ( checkEquality( this->variable_, mem ) == false ) 295 296 { 296 297 // value changed so remark for callback … … 301 302 } 302 303 // now write the data 303 SynchronisableVariable<T>::setAndIncrease(mem);304 loadAndIncrease(this->variable_, mem); 304 305 // now do a callback if neccessary 305 306 if ( callback ) … … 310 311 template <class T> inline uint32_t SynchronisableVariableBidirectional<T>::getSize(uint8_t mode) 311 312 { 312 return SynchronisableVariable<T>::returnSize() + sizeof(varReference_);313 return returnSize( this->variable_ ) + sizeof(varReference_); 313 314 } 314 315 … … 316 317 } 317 318 318 #include "network/synchronisable/SynchronisableVariableSpecialisations.h"319 //#include "network/synchronisable/SynchronisableVariableSpecialisations.h" 319 320 320 321 #endif
Note: See TracChangeset
for help on using the changeset viewer.