Changeset 11002 for code/branches/cpp11_v2/src/libraries/network
- Timestamp:
- Dec 30, 2015, 9:13:14 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/network/synchronisable/Synchronisable.h
r10996 r11002 207 207 { 208 208 template <class T, bool = std::is_enum<T>::value> 209 struct RealType;209 struct UnderlyingType; 210 210 template <class T> 211 struct RealType<T, true> { typedef typename std::underlying_type<T>::type type; };211 struct UnderlyingType<T, true> { typedef typename std::underlying_type<T>::type type; }; 212 212 template <class T> 213 struct RealType<T, false> { typedef T type; };213 struct UnderlyingType<T, false> { typedef T type; }; 214 214 } 215 215 … … 217 217 void Synchronisable::registerVariable(T& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional) 218 218 { 219 typedef typename detail:: RealType<T>::type RealType;219 typedef typename detail::UnderlyingType<T>::type UnderlyingType; 220 220 if (bidirectional) 221 221 { 222 syncList_.push_back(new SynchronisableVariableBidirectional< RealType>(reinterpret_cast<RealType&>(variable), mode, cb));222 syncList_.push_back(new SynchronisableVariableBidirectional<UnderlyingType>(reinterpret_cast<UnderlyingType&>(variable), mode, cb)); 223 223 this->dataSize_ += syncList_.back()->getSize(state_); 224 224 } 225 225 else 226 226 { 227 syncList_.push_back(new SynchronisableVariable< RealType>(reinterpret_cast<RealType&>(variable), mode, cb));227 syncList_.push_back(new SynchronisableVariable<UnderlyingType>(reinterpret_cast<UnderlyingType&>(variable), mode, cb)); 228 228 if ( this->state_ == mode ) 229 229 this->dataSize_ += syncList_.back()->getSize(state_); … … 255 255 void Synchronisable::registerVariable( std::set<T>& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional) 256 256 { 257 typedef typename detail:: RealType<T>::type RealType;257 typedef typename detail::UnderlyingType<T>::type UnderlyingType; 258 258 SynchronisableVariableBase* sv; 259 259 if (bidirectional) 260 sv = new SynchronisableVariableBidirectional<std::set< RealType>>(reinterpret_cast<std::set<RealType>&>(variable), mode, cb);260 sv = new SynchronisableVariableBidirectional<std::set<UnderlyingType>>(reinterpret_cast<std::set<UnderlyingType>&>(variable), mode, cb); 261 261 else 262 sv = new SynchronisableVariable<std::set< RealType>>(reinterpret_cast<std::set<RealType>&>(variable), mode, cb);262 sv = new SynchronisableVariable<std::set<UnderlyingType>>(reinterpret_cast<std::set<UnderlyingType>&>(variable), mode, cb); 263 263 syncList_.push_back(sv); 264 264 stringList_.push_back(sv);
Note: See TracChangeset
for help on using the changeset viewer.