Changeset 3333 for code/trunk
- Timestamp:
- Jul 22, 2009, 1:00:46 PM (15 years ago)
- Location:
- code/trunk/src/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/core/Identifier.h
r3332 r3333 458 458 459 459 // Add pointer of type T to the map in the OrxonoxClass instance that enables "dynamic_casts" 460 object->objectPointers_.push_back(std::make_pair(this->getClassID(), reinterpret_cast<void*>(object)));460 object->objectPointers_.push_back(std::make_pair(this->getClassID(), static_cast<void*>(object))); 461 461 return false; 462 462 } … … 496 496 */ 497 497 template <class T, class U> 498 FORCEINLINE T orxonox_cast(U *source)498 FORCEINLINE T orxonox_cast(U source) 499 499 { 500 500 #ifdef ORXONOX_COMPILER_MSVC 501 typedef Loki::TypeTraits< T>::PointeeType ClassType;501 typedef Loki::TypeTraits<typename Loki::TypeTraits<T>::PointeeType>::NonConstType ClassType; 502 502 return source->template getDerivedPointer<ClassType>(ClassIdentifier<ClassType>::getIdentifier()->getClassID()); 503 503 #else -
code/trunk/src/core/OrxonoxClass.h
r3327 r3333 101 101 */ 102 102 template <class T> 103 FORCEINLINE T* getDerivedPointer(unsigned int classID) const103 FORCEINLINE T* getDerivedPointer(unsigned int classID) 104 104 { 105 105 for (int i = this->objectPointers_.size() - 1; i >= 0; --i) 106 106 { 107 107 if (this->objectPointers_[i].first == classID) 108 return reinterpret_cast<T*>(this->objectPointers_[i].second);108 return static_cast<T*>(this->objectPointers_[i].second); 109 109 } 110 110 return NULL; 111 } 112 //! Const version of getDerivedPointer 113 template <class T> 114 FORCEINLINE const T* getDerivedPointer(unsigned int classID) const 115 { 116 return const_cast<OrxonoxClass*>(this)->getDerivedPointer<T>(classID); 111 117 } 112 118
Note: See TracChangeset
for help on using the changeset viewer.