[Orxonox-commit 4933] r9602 - in code/branches/core6/src/libraries/core: class object
landauf at orxonox.net
landauf at orxonox.net
Fri Mar 29 22:37:16 CET 2013
Author: landauf
Date: 2013-03-29 22:37:15 +0100 (Fri, 29 Mar 2013)
New Revision: 9602
Modified:
code/branches/core6/src/libraries/core/class/Identifier.cc
code/branches/core6/src/libraries/core/class/Identifier.h
code/branches/core6/src/libraries/core/object/ClassFactory.h
Log:
delete factory before setting a new one (mostly for unit tests)
Modified: code/branches/core6/src/libraries/core/class/Identifier.cc
===================================================================
--- code/branches/core6/src/libraries/core/class/Identifier.cc 2013-03-29 17:31:05 UTC (rev 9601)
+++ code/branches/core6/src/libraries/core/class/Identifier.cc 2013-03-29 21:37:15 UTC (rev 9602)
@@ -164,6 +164,15 @@
}
}
+ void Identifier::setFactory(Factory* factory)
+ {
+ if (this->factory_)
+ delete this->factory_;
+
+ this->factory_ = factory;
+ }
+
+
/**
@brief Creates an object of the type the Identifier belongs to.
@return The new object
Modified: code/branches/core6/src/libraries/core/class/Identifier.h
===================================================================
--- code/branches/core6/src/libraries/core/class/Identifier.h 2013-03-29 17:31:05 UTC (rev 9601)
+++ code/branches/core6/src/libraries/core/class/Identifier.h 2013-03-29 21:37:15 UTC (rev 9602)
@@ -130,7 +130,7 @@
inline ObjectListBase* getObjects() const { return this->objects_; }
/// Sets the Factory.
- inline void addFactory(Factory* factory) { this->factory_ = factory; }
+ void setFactory(Factory* factory);
/// Returns true if the Identifier has a Factory.
inline bool hasFactory() const { return (this->factory_ != 0); }
Modified: code/branches/core6/src/libraries/core/object/ClassFactory.h
===================================================================
--- code/branches/core6/src/libraries/core/object/ClassFactory.h 2013-03-29 17:31:05 UTC (rev 9601)
+++ code/branches/core6/src/libraries/core/object/ClassFactory.h 2013-03-29 21:37:15 UTC (rev 9602)
@@ -73,7 +73,7 @@
ClassFactory(const std::string& name, bool bLoadable = true)
{
orxout(verbose, context::misc::factory) << "Create entry for " << name << " in Factory." << endl;
- ClassIdentifier<T>::getIdentifier(name)->addFactory(this);
+ ClassIdentifier<T>::getIdentifier(name)->setFactory(this);
ClassIdentifier<T>::getIdentifier()->setLoadable(bLoadable);
}
More information about the Orxonox-commit
mailing list