[Orxonox-commit 619] r3151 - branches/pch/src/core
rgrieder at orxonox.net
rgrieder at orxonox.net
Fri Jun 12 13:46:26 CEST 2009
Author: rgrieder
Date: 2009-06-12 13:46:26 +0200 (Fri, 12 Jun 2009)
New Revision: 3151
Modified:
branches/pch/src/core/CoreIncludes.h
branches/pch/src/core/Identifier.cc
branches/pch/src/core/Identifier.h
Log:
Removing superfluous feature: construction callbacks.
If we ever need them again (which I highly doubt since you can achieve the same with an interface class), SVN is at our service.
Modified: branches/pch/src/core/CoreIncludes.h
===================================================================
--- branches/pch/src/core/CoreIncludes.h 2009-06-12 08:58:40 UTC (rev 3150)
+++ branches/pch/src/core/CoreIncludes.h 2009-06-12 11:46:26 UTC (rev 3151)
@@ -45,7 +45,6 @@
#include "Identifier.h"
#include "Factory.h"
#include "ClassFactory.h"
-#include "Functor.h"
#include "util/Debug.h"
@@ -128,12 +127,4 @@
#define ClassByID(networkID) \
orxonox::Factory::getIdentifier(networkID)
-/**
- @brief Registers a member function as callback when an object of 'type' is created.
- @param
-*/
-#define RegisterConstructionCallback(ThisClassName, TargetClassName, FunctionName) \
- orxonox::ClassIdentifier<TargetClassName>::getIdentifier()->addConstructionCallback( \
- orxonox::createFunctor(&ThisClassName::FunctionName)->setObject(this))
-
#endif /* _CoreIncludes_H__ */
Modified: branches/pch/src/core/Identifier.cc
===================================================================
--- branches/pch/src/core/Identifier.cc 2009-06-12 08:58:40 UTC (rev 3150)
+++ branches/pch/src/core/Identifier.cc 2009-06-12 11:46:26 UTC (rev 3151)
@@ -62,7 +62,6 @@
this->bHasConfigValues_ = false;
this->bHasConsoleCommands_ = false;
- this->bHasConstructionCallback_ = false;
this->children_ = new std::set<const Identifier*>();
this->directChildren_ = new std::set<const Identifier*>();
@@ -92,8 +91,6 @@
delete (it->second);
for (std::map<std::string, XMLPortObjectContainer*>::iterator it = this->xmlportObjectContainers_.begin(); it != this->xmlportObjectContainers_.end(); ++it)
delete (it->second);
- for (std::vector<Functor*>::iterator it = this->constructionCallbacks_.begin(); it != this->constructionCallbacks_.end(); ++it)
- delete *it;
}
/**
@@ -518,38 +515,6 @@
}
/**
- @brief Adds a construction callback functor that gets called every time an object is created.
- @param functor Functor pointer to any function with no argument.
- */
- void Identifier::addConstructionCallback(Functor* functor)
- {
- for (unsigned int i = 0; i < this->constructionCallbacks_.size(); ++i)
- {
- if (this->constructionCallbacks_[i] == functor)
- return;
- }
- this->constructionCallbacks_.push_back(functor);
- this->bHasConstructionCallback_ = true;
- }
-
- /**
- @brief Removes a construction callback functor that gets called every time an object is created.
- @param functor Functor pointer to any function with no argument.
- */
- void Identifier::removeConstructionCallback(Functor* functor)
- {
- for (unsigned int i = 0; i < this->constructionCallbacks_.size(); ++i)
- {
- if (this->constructionCallbacks_[i] == functor)
- {
- this->constructionCallbacks_.erase(this->constructionCallbacks_.begin() + i);
- }
- }
- if (constructionCallbacks_.empty())
- this->bHasConstructionCallback_ = false;
- }
-
- /**
@brief Lists the names of all Identifiers in a std::set<const Identifier*>.
@param out The outstream
@param list The list (or set) of Identifiers
Modified: branches/pch/src/core/Identifier.h
===================================================================
--- branches/pch/src/core/Identifier.h 2009-06-12 08:58:40 UTC (rev 3150)
+++ branches/pch/src/core/Identifier.h 2009-06-12 11:46:26 UTC (rev 3151)
@@ -222,8 +222,6 @@
inline bool hasConfigValues() const { return this->bHasConfigValues_; }
/** @brief Returns true if this class has at least one console command. @return True if this class has at least one console command */
inline bool hasConsoleCommands() const { return this->bHasConsoleCommands_; }
- /** @brief Returns true if this class has at least one construction callback Functor registered. */
- inline bool hasConstructionCallback() const { return this->bHasConstructionCallback_; }
/** @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 */
inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); }
@@ -251,9 +249,6 @@
ConsoleCommand* getConsoleCommand(const std::string& name) const;
ConsoleCommand* getLowercaseConsoleCommand(const std::string& name) const;
- void addConstructionCallback(Functor* functor);
- void removeConstructionCallback(Functor* functor);
-
void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass);
static void destroyAllIdentifiers();
@@ -276,9 +271,6 @@
/** @brief Returns the direct children of the class the Identifier belongs to. @return The list of all direct children */
inline std::set<const Identifier*>& getDirectChildrenIntern() const { return (*this->directChildren_); }
- bool bHasConstructionCallback_; //!< True if at least one Functor is registered to get informed when an object of type T is created.
- std::vector<Functor*> constructionCallbacks_; //!< All construction callback Functors of this class.
-
ObjectListBase* objects_; //!< The list of all objects of this class
private:
@@ -438,13 +430,6 @@
{
COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl;
object->getMetaList().add(this->objects_, this->objects_->add(new ObjectListElement<T>(object)));
- if (this->bHasConstructionCallback_)
- {
- // Call all registered callbacks that a new object of type T has been created.
- // Do NOT deliver a T* pointer here because it's way too risky (object not yet fully created).
- for (unsigned int i = 0; i < this->constructionCallbacks_.size(); ++i)
- (*constructionCallbacks_[i])();
- }
}
/**
More information about the Orxonox-commit
mailing list