Changeset 3151 for code/branches/pch/src/core/Identifier.h
- Timestamp:
- Jun 12, 2009, 1:46:26 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pch/src/core/Identifier.h
r3145 r3151 223 223 /** @brief Returns true if this class has at least one console command. @return True if this class has at least one console command */ 224 224 inline bool hasConsoleCommands() const { return this->bHasConsoleCommands_; } 225 /** @brief Returns true if this class has at least one construction callback Functor registered. */226 inline bool hasConstructionCallback() const { return this->bHasConstructionCallback_; }227 225 228 226 /** @brief Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents. @return The status of the class-hierarchy creation */ … … 251 249 ConsoleCommand* getConsoleCommand(const std::string& name) const; 252 250 ConsoleCommand* getLowercaseConsoleCommand(const std::string& name) const; 253 254 void addConstructionCallback(Functor* functor);255 void removeConstructionCallback(Functor* functor);256 251 257 252 void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass); … … 276 271 /** @brief Returns the direct children of the class the Identifier belongs to. @return The list of all direct children */ 277 272 inline std::set<const Identifier*>& getDirectChildrenIntern() const { return (*this->directChildren_); } 278 279 bool bHasConstructionCallback_; //!< True if at least one Functor is registered to get informed when an object of type T is created.280 std::vector<Functor*> constructionCallbacks_; //!< All construction callback Functors of this class.281 273 282 274 ObjectListBase* objects_; //!< The list of all objects of this class … … 439 431 COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl; 440 432 object->getMetaList().add(this->objects_, this->objects_->add(new ObjectListElement<T>(object))); 441 if (this->bHasConstructionCallback_)442 {443 // Call all registered callbacks that a new object of type T has been created.444 // Do NOT deliver a T* pointer here because it's way too risky (object not yet fully created).445 for (unsigned int i = 0; i < this->constructionCallbacks_.size(); ++i)446 (*constructionCallbacks_[i])();447 }448 433 } 449 434
Note: See TracChangeset
for help on using the changeset viewer.