Changeset 3239 for code/branches/core4/src/core
- Timestamp:
- Jun 28, 2009, 2:45:37 PM (16 years ago)
- Location:
- code/branches/core4/src/core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core4/src/core/EventIncludes.h
r3223 r3239 54 54 this->addEventContainer(eventname, containername); \ 55 55 } \ 56 event.castedOriginator_ = orxonox::orxonox_cast<subclassname >(event.originator_); \56 event.castedOriginator_ = orxonox::orxonox_cast<subclassname*>(event.originator_); \ 57 57 containername->process(this, event) 58 58 … … 66 66 this->addEventContainer(eventname, containername); \ 67 67 } \ 68 event.castedOriginator_ = orxonox::orxonox_cast<subclassname >(event.originator_); \68 event.castedOriginator_ = orxonox::orxonox_cast<subclassname*>(event.originator_); \ 69 69 containername->process(this, event) 70 70 -
code/branches/core4/src/core/Identifier.h
r3224 r3239 483 483 // ### orxonox_cast ### 484 484 // ############################### 485 //! Helper struct to have orxonox_cast<T*> instead of orxonox_cast<T> 486 template <class T, class U> 487 struct OrxonoxCaster 488 { 489 static T* cast(U* source) 490 { 491 // If you see this function in a compiler error description, it means 492 // you were misusing orxonox_cast. You must always cast to a pointer type! 493 *****T(); 494 } 495 }; 496 497 //! Helper struct to have orxonox_cast<T*> instead of orxonox_cast<T*> 498 template <class T, class U> 499 struct OrxonoxCaster<T*, U> 500 { 501 FORCEINLINE static T* cast(U* source) 502 { 503 #ifdef ORXONOX_COMPILER_MSVC 504 return source->template getDerivedPointer<T>(ClassIdentifier<T>::getIdentifier()->getClassID()); 505 #else 506 return dynamic_cast<T*>(source); 507 #endif 508 } 509 }; 510 485 511 /** 486 512 @brief … … 495 521 */ 496 522 template <class T, class U> 497 FORCEINLINE T* orxonox_cast(U* source) 498 { 499 #ifdef ORXONOX_COMPILER_MSVC 500 return source->template getDerivedPointer<T>(ClassIdentifier<T>::getIdentifier()->getClassID()); 501 #else 502 return dynamic_cast<T*>(source); 503 #endif 523 FORCEINLINE T orxonox_cast(U* source) 524 { 525 return OrxonoxCaster<T, U>::cast(source); 504 526 } 505 527 … … 597 619 if (newObject) 598 620 { 599 return orxonox_cast<T >(newObject);621 return orxonox_cast<T*>(newObject); 600 622 } 601 623 else -
code/branches/core4/src/core/Iterator.h
r3223 r3239 240 240 { 241 241 if (this->element_) 242 return orxonox_cast<T >(this->element_->objectBase_);242 return orxonox_cast<T*>(this->element_->objectBase_); 243 243 else 244 244 return 0; … … 252 252 { 253 253 if (this->element_) 254 return orxonox_cast<T >(this->element_->objectBase_);254 return orxonox_cast<T*>(this->element_->objectBase_); 255 255 else 256 256 return 0; -
code/branches/core4/src/core/XMLPort.h
r3223 r3239 565 565 newObject->setLoaderIndentation(object->getLoaderIndentation() + " "); 566 566 567 O* castedObject = orxonox_cast<O >(newObject);567 O* castedObject = orxonox_cast<O*>(newObject); 568 568 assert(castedObject); 569 569
Note: See TracChangeset
for help on using the changeset viewer.