Changeset 3325 for code/trunk/src/core/OrxonoxClass.h
- Timestamp:
- Jul 19, 2009, 3:48:00 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/core4 merged: 3222-3224,3238
- Property svn:mergeinfo changed
-
code/trunk/src/core/OrxonoxClass.h
r3280 r3325 50 50 class _CoreExport OrxonoxClass 51 51 { 52 template <class T> 53 friend class ClassIdentifier; 54 52 55 public: 53 56 OrxonoxClass(); … … 59 62 /** @brief Returns the Identifier of the object. @return The Identifier */ 60 63 inline Identifier* getIdentifier() const { return this->identifier_; } 61 62 /** @brief Sets the Identifier of the object. Used by the RegisterObject-macro. */63 inline void setIdentifier(Identifier* identifier) { this->identifier_ = identifier; }64 65 /** @brief Returns the list of all parents of the object. @return The list */66 inline std::set<const Identifier*>* getParents() const { return this->parents_; }67 68 /** @brief Creates the parents-list. */69 inline void createParents() { this->parents_ = new std::set<const Identifier*>(); }70 71 /** @brief Returns the MetaObjectList of the object, containing a link to all ObjectLists and ObjectListElements the object is registered in. @return The list */72 inline MetaObjectList& getMetaList() { return (*this->metaList_); }73 74 64 75 65 bool isA(const Identifier* identifier); … … 101 91 bool isDirectParentOf(const OrxonoxClass* object); 102 92 93 /** 94 @brief 95 Returns a valid pointer of any derived type that is 96 registered in the class hierarchy. 97 @return 98 Returns NULL if the no pointer was found. 99 */ 100 template <class T> 101 FORCEINLINE T* getDerivedPointer(unsigned int classID) const 102 { 103 for (int i = this->objectPointers_.size() - 1; i >= 0; --i) 104 { 105 if (this->objectPointers_[i].first == classID) 106 return reinterpret_cast<T*>(this->objectPointers_[i].second); 107 } 108 return NULL; 109 } 110 103 111 private: 104 112 Identifier* identifier_; //!< The Identifier of the object 105 113 std::set<const Identifier*>* parents_; //!< List of all parents of the object 106 114 MetaObjectList* metaList_; //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in 115 //! 'Fast map' that holds this-pointers of all derived types 116 std::vector<std::pair<unsigned int, void*> > objectPointers_; 107 117 }; 108 118 }
Note: See TracChangeset
for help on using the changeset viewer.