Changeset 5779
- Timestamp:
- Sep 24, 2009, 2:55:34 AM (15 years ago)
- Location:
- code/branches/core5/src/libraries/core
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/libraries/core/ClassFactory.h
r5778 r5779 46 46 namespace orxonox 47 47 { 48 // ########################### ####49 // ### BaseFactory ###50 // ########################### ####48 // ########################### 49 // ### Factory ### 50 // ########################### 51 51 //! Base-class of ClassFactory. 52 class _CoreExport BaseFactory52 class _CoreExport Factory 53 53 { 54 54 public: 55 virtual ~ BaseFactory() {};55 virtual ~Factory() {}; 56 56 virtual BaseObject* fabricate(BaseObject* creator) = 0; 57 57 }; … … 62 62 //! The ClassFactory is able to create new objects of a specific class. 63 63 template <class T> 64 class ClassFactory : public BaseFactory64 class ClassFactory : public Factory 65 65 { 66 66 public: -
code/branches/core5/src/libraries/core/CoreIncludes.h
r5778 r5779 80 80 */ 81 81 #define CreateFactory(ClassName) \ 82 BaseFactory*ClassName##Factory = new orxonox::ClassFactory<ClassName>(#ClassName, true)82 Factory* _##ClassName##Factory = new orxonox::ClassFactory<ClassName>(#ClassName, true) 83 83 84 84 /** … … 87 87 */ 88 88 #define CreateUnloadableFactory(ClassName) \ 89 BaseFactory*ClassName##Factory = new orxonox::ClassFactory<ClassName>(#ClassName, false)89 Factory* _##ClassName##Factory = new orxonox::ClassFactory<ClassName>(#ClassName, false) 90 90 91 91 /** … … 100 100 { 101 101 /** 102 @brief Returns the Identifier with a given name through the factory.102 @brief Returns the Identifier with a given name. 103 103 @param String The name of the class 104 104 */ … … 109 109 110 110 /** 111 @brief Returns the Identifier with a given network ID through the factory. 111 @brief Returns the Identifier with a given lowercase name. 112 @param String The lowercase name of the class 113 */ 114 inline Identifier* ClassByLowercaseString(const std::string& name) 115 { 116 return Identifier::getIdentifierByLowercaseString(name); 117 } 118 119 /** 120 @brief Returns the Identifier with a given network ID. 112 121 @param networkID The network ID of the class 113 122 */ -
code/branches/core5/src/libraries/core/CorePrereqs.h
r5738 r5779 87 87 class ArgumentCompleter; 88 88 class ArgumentCompletionListElement; 89 class BaseFactory;90 89 class BaseMetaObjectListElement; 91 90 class BaseObject; -
code/branches/core5/src/libraries/core/Identifier.cc
r5778 r5779 372 372 373 373 /** 374 @brief Returns the Identifier with a given name in lowercase. 375 @param name The name of the wanted Identifier 376 @return The Identifier 377 */ 378 Identifier* Identifier::getIdentifierByLowercaseString(const std::string& name) 379 { 380 std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseStringIdentifierMapIntern().find(name); 381 if (it != Identifier::getLowercaseStringIdentifierMapIntern().end()) 382 return it->second; 383 else 384 return 0; 385 } 386 387 /** 374 388 @brief Returns the Identifier with a given network ID. 375 389 @param id The network ID of the wanted Identifier -
code/branches/core5/src/libraries/core/Identifier.h
r5778 r5779 103 103 104 104 /** @brief Sets the Factory. @param factory The factory to assign */ 105 inline void addFactory( BaseFactory* factory) { this->factory_ = factory; }105 inline void addFactory(Factory* factory) { this->factory_ = factory; } 106 106 /** @brief Returns true if the Identifier has a Factory. */ 107 107 inline bool hasFactory() const { return (this->factory_ != 0); } … … 165 165 166 166 static Identifier* getIdentifierByString(const std::string& name); 167 static Identifier* getIdentifierByLowercaseString(const std::string& name); 167 168 static Identifier* getIdentifierByID(uint32_t id); 168 169 … … 334 335 bool bLoadable_; //!< False = it's not permitted to load the object through XML 335 336 std::string name_; //!< The name of the class the Identifier belongs to 336 BaseFactory* factory_;//!< The Factory, able to create new objects of the given class (if available)337 Factory* factory_; //!< The Factory, able to create new objects of the given class (if available) 337 338 static int hierarchyCreatingCounter_s; //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading) 338 339 uint32_t networkID_; //!< The network ID to identify a class through the network
Note: See TracChangeset
for help on using the changeset viewer.