Changeset 5783 for code/branches/core5/src/libraries/core/ClassFactory.h
- Timestamp:
- Sep 24, 2009, 8:58:27 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/libraries/core/ClassFactory.h
r5779 r5783 65 65 { 66 66 public: 67 ClassFactory(const std::string& name, bool bLoadable = true); 68 BaseObject* fabricate(BaseObject* creator); 67 /** 68 @brief Constructor: Adds the ClassFactory to the Identifier of the same type. 69 @param name The name of the class 70 @param bLoadable True if the class can be loaded through XML 71 */ 72 ClassFactory(const std::string& name, bool bLoadable = true) 73 { 74 COUT(4) << "*** ClassFactory: Create entry for " << name << " in Factory." << std::endl; 75 ClassIdentifier<T>::getIdentifier(name)->addFactory(this); 76 ClassIdentifier<T>::getIdentifier()->setLoadable(bLoadable); 77 } 78 79 /** 80 @brief Creates and returns a new object of class T. 81 @return The new object 82 */ 83 inline BaseObject* fabricate(BaseObject* creator) 84 { 85 return static_cast<BaseObject*>(new T(creator)); 86 } 69 87 }; 70 71 /**72 @brief Adds the ClassFactory to the Identifier of the same type.73 @param name The name of the class74 @param bLoadable True if the class can be loaded through XML75 */76 template <class T>77 ClassFactory<T>::ClassFactory(const std::string& name, bool bLoadable)78 {79 COUT(4) << "*** ClassFactory: Create entry for " << name << " in Factory." << std::endl;80 ClassIdentifier<T>::getIdentifier(name)->addFactory(this);81 ClassIdentifier<T>::getIdentifier()->setLoadable(bLoadable);82 }83 84 /**85 @brief Creates and returns a new object of class T.86 @return The new object87 */88 template <class T>89 inline BaseObject* ClassFactory<T>::fabricate(BaseObject* creator)90 {91 return static_cast<BaseObject*>(new T(creator));92 }93 88 } 94 89
Note: See TracChangeset
for help on using the changeset viewer.