Changeset 3223 for code/branches/core4/src/core/OrxonoxClass.h
- Timestamp:
- Jun 23, 2009, 7:28:48 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core4/src/core/OrxonoxClass.h
r3196 r3223 50 50 class _CoreExport OrxonoxClass 51 51 { 52 template <class T> 53 friend class ClassIdentifier; 54 52 55 public: 53 56 OrxonoxClass(); … … 101 104 bool isDirectParentOf(const OrxonoxClass* object); 102 105 106 /** 107 @brief 108 Returns a valid pointer of any derived type that is 109 registered in the class hierarchy. 110 @return 111 Returns NULL if the no pointer was found. 112 */ 113 template <class T> 114 FORCEINLINE T* getDerivedPointer(unsigned int classID) const 115 { 116 for (int i = this->objectPointers_.size() - 1; i >= 0; --i) 117 { 118 if (this->objectPointers_[i].first == classID) 119 return reinterpret_cast<T*>(this->objectPointers_[i].second); 120 } 121 return NULL; 122 } 123 103 124 private: 104 125 Identifier* identifier_; //!< The Identifier of the object 105 126 std::set<const Identifier*>* parents_; //!< List of all parents of the object 106 127 MetaObjectList* metaList_; //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in 128 //! 'Fast map' that holds this-pointers of all derived types 129 std::vector<std::pair<unsigned int, void*> > objectPointers_; 107 130 }; 108 131 }
Note: See TracChangeset
for help on using the changeset viewer.