Changeset 4931 in orxonox.OLD for orxonox/trunk/src/util
- Timestamp:
- Jul 22, 2005, 2:26:59 AM (19 years ago)
- Location:
- orxonox/trunk/src/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/object_manager.cc
r4930 r4931 108 108 } 109 109 110 111 110 112 /** 111 113 * constructor -
orxonox/trunk/src/util/object_manager.h
r4930 r4931 21 21 22 22 #include "base_object.h" 23 #include "class_id.h" 23 24 24 25 template<class T> class tList; … … 57 58 58 59 /** 59 * Creates a factory to a Loadable Class. 60 * this should be used at the beginning of all the Classes that should be loadable (in the cc-file) 60 * Creates a factory to a Loadable FastObject. 61 61 */ 62 #define CREATE_FAST_ FACTORY(CLASS_NAME, CLASS_ID) \63 t Object<CLASS_NAME>* global_##CLASS_NAME##_Object = newtObject<CLASS_NAME>(#CLASS_NAME, CLASS_ID)62 #define CREATE_FAST_OBJECT(CLASS_NAME, CLASS_ID) \ 63 tFastObject<CLASS_NAME>* global_##CLASS_NAME##_FastObject = new tFastObject<CLASS_NAME>(#CLASS_NAME, CLASS_ID) 64 64 65 //! The Fa ctoryis a loadable object handler65 //! The FastObject is a loadable object handler 66 66 class FastObject : public BaseObject { 67 67 … … 75 75 /** sets the Next factory in the list @param nextFactory the next factory */ 76 76 inline void setNext( FastObject* nextFastObject) { this->next = nextFastObject; }; 77 /** @returns the first factory*/77 /** @returns the first FastObject */ 78 78 static FastObject* getFirst() { return FastObject::first; }; 79 /** @returns the next factory*/79 /** @returns the next FastObject */ 80 80 FastObject* getNext() const { return this->next; }; 81 81 82 protected: 83 ClassID storedClassID; //!< The classID of the specified class. 84 82 85 private: 83 FastObject* next; //!< pointer to the next factory. 84 static FastObject* first; //!< A pointer to the first factory. 85 ClassID storedClassID; //!< The classID of the specified class. 86 FastObject* next; //!< pointer to the next FastObject. 87 static FastObject* first; //!< A pointer to the first FastObject. 86 88 }; 87 89 88 90 /** 89 * a factorythat is able to load any kind of Object90 91 * a FastObject that is able to load any kind of Object 92 * (this is a Functor) 91 93 */ 92 94 template<class T> class tFastObject : public FastObject … … 100 102 101 103 /** 102 * construnts a factory with 103 * @param factoryName the name of the factory 104 * construnts a FastObject with 105 * @param fastObjectName the name of the FastObject 106 * @param fastObject the ID of the class 104 107 */ 105 108 template<class T> … … 112 115 BaseObject* tFastObject<T>::fabricate(ClassID fastObject) 113 116 { 114 if(this->classID == fastObject)115 return new T ( root);116 else if( getNext() != NULL)117 return getNext()->fabricate( root);118 else117 // if(this->classID == fastObject) 118 //return new T (); 119 //else if( getNext() != NULL) 120 // return getNext()->fabricate(); 121 // else 119 122 return NULL; 120 123 }
Note: See TracChangeset
for help on using the changeset viewer.