[Orxonox-commit 4902] r9571 - in code/branches/core6/src: libraries/core/command libraries/core/object libraries/util orxonox/interfaces
landauf at orxonox.net
landauf at orxonox.net
Sun Mar 24 21:03:22 CET 2013
Author: landauf
Date: 2013-03-24 21:03:22 +0100 (Sun, 24 Mar 2013)
New Revision: 9571
Modified:
code/branches/core6/src/libraries/core/command/Functor.h
code/branches/core6/src/libraries/core/object/SmartPtr.h
code/branches/core6/src/libraries/core/object/WeakPtr.h
code/branches/core6/src/libraries/util/ScopedSingletonManager.h
code/branches/core6/src/orxonox/interfaces/Pickupable.cc
code/branches/core6/src/orxonox/interfaces/Pickupable.h
Log:
using Destroyable instead of OrxonoxClass now wherever the destruction-related members are addressed
Modified: code/branches/core6/src/libraries/core/command/Functor.h
===================================================================
--- code/branches/core6/src/libraries/core/command/Functor.h 2013-03-24 19:51:37 UTC (rev 9570)
+++ code/branches/core6/src/libraries/core/command/Functor.h 2013-03-24 20:03:22 UTC (rev 9571)
@@ -119,7 +119,7 @@
#include "util/Output.h"
#include "util/MultiType.h"
-#include "core/class/OrxonoxClass.h"
+#include "core/object/Destroyable.h"
#include "FunctorPtr.h"
namespace orxonox
@@ -302,12 +302,12 @@
protected:
/// Casts the object and registers as destruction listener.
inline void registerObject(O* object)
- { OrxonoxClass* base = dynamic_cast<OrxonoxClass*>(object); if (base) { this->registerAsDestructionListener(base); } }
+ { Destroyable* base = dynamic_cast<Destroyable*>(object); if (base) { this->registerAsDestructionListener(base); } }
/// Casts the object and unregisters as destruction listener.
inline void unregisterObject(O* object)
- { OrxonoxClass* base = dynamic_cast<OrxonoxClass*>(object); if (base) { this->unregisterAsDestructionListener(base); } }
+ { Destroyable* base = dynamic_cast<Destroyable*>(object); if (base) { this->unregisterAsDestructionListener(base); } }
- /// Will be called by OrxonoxClass::~OrxonoxClass() if the stored object is deleted and the Functor is in safe mode.
+ /// Will be called by Destroyable::~Destroyable() if the stored object is deleted and the Functor is in safe mode.
inline void objectDeleted()
{ this->object_ = 0; }
Modified: code/branches/core6/src/libraries/core/object/SmartPtr.h
===================================================================
--- code/branches/core6/src/libraries/core/object/SmartPtr.h 2013-03-24 19:51:37 UTC (rev 9570)
+++ code/branches/core6/src/libraries/core/object/SmartPtr.h 2013-03-24 20:03:22 UTC (rev 9571)
@@ -43,7 +43,7 @@
orxonox::SmartPtr is an implementation of a smart pointer - it wraps a pointer to an
object and keeps this object alive until no SmartPtr points to this object anymore.
In contrast to orxonox::SharedPtr, SmartPtr works only with classes that are derived
- from orxonox::OrxonoxClass, because it's an intrusive implementation, meaning the
+ from orxonox::Destroyable, because it's an intrusive implementation, meaning the
reference counter is stored in the object itself.
It's possible to use normal pointers and smart pointers to an object simultaneously.
@@ -77,7 +77,7 @@
SmartPtr<OtherClass> object_; // a pointer to an instance of OtherClass is stored in a SmartPtr
};
@endcode
- In this example we assume that OtherClass is a child of OrxonoxClass. We don't care
+ In this example we assume that OtherClass is a child of Destroyable. We don't care
about the inheritance of MyClass though.
Now we create an instance of MyClass and assign a pointer to an instance of OtherClass:
@@ -122,7 +122,7 @@
#include <cassert>
-#include "core/class/OrxonoxClass.h"
+#include "core/object/Destroyable.h"
#include "WeakPtr.h"
namespace orxonox
@@ -226,8 +226,8 @@
return this->pointer_;
}
- /// Returns the wrapped pointer as @c OrxonoxClass*
- inline OrxonoxClass* getBase() const
+ /// Returns the wrapped pointer as @c Destroyable*
+ inline Destroyable* getBase() const
{
return this->base_;
}
@@ -267,7 +267,7 @@
other.pointer_ = temp;
}
{
- OrxonoxClass* temp = this->base_;
+ Destroyable* temp = this->base_;
this->base_ = other.base_;
other.base_ = temp;
}
@@ -281,7 +281,7 @@
private:
T* pointer_; ///< The wrapped pointer to an object of type @a T
- OrxonoxClass* base_; ///< The wrapped pointer, casted up to OrxonoxClass (this is needed because with just a T* pointer, SmartPtr couln't be used with forward declarations)
+ Destroyable* base_; ///< The wrapped pointer, casted up to Destroyable (this is needed because with just a T* pointer, SmartPtr couln't be used with forward declarations)
};
/// Swaps the contents of two smart pointers.
Modified: code/branches/core6/src/libraries/core/object/WeakPtr.h
===================================================================
--- code/branches/core6/src/libraries/core/object/WeakPtr.h 2013-03-24 19:51:37 UTC (rev 9570)
+++ code/branches/core6/src/libraries/core/object/WeakPtr.h 2013-03-24 20:03:22 UTC (rev 9571)
@@ -39,7 +39,7 @@
NULL. This can be used to store pointers to objects without knowing when they will be
destroyed.
- WeakPtr works only with objects that are derived from orxonox::OrxonoxClass, because
+ WeakPtr works only with objects that are derived from orxonox::Destroyable, because
WeakPtr is intrusive and registers itself in the stored object, to get a notification if
the object is being deleted.
@@ -57,7 +57,7 @@
if (pointer) // checks if pointer is not NULL (which is now false)
pointer->someFunction(); // this will not be executed
@endcode
- In this example we assumed that MyClass is derived of OrxonoxClass (otherwise it couldn't
+ In this example we assumed that MyClass is derived of Destroyable (otherwise it couldn't
be used with a WeakPtr).
A callback can be registerd with the WeakPtr that will be called if the object gets deleted.
@@ -84,7 +84,7 @@
#include <cassert>
-#include "core/class/OrxonoxClass.h"
+#include "core/object/Destroyable.h"
#include "core/command/Functor.h"
namespace orxonox
@@ -168,8 +168,8 @@
return this->pointer_;
}
- /// Returns the wrapped pointer as @c OrxonoxClass*
- inline OrxonoxClass* getBase() const
+ /// Returns the wrapped pointer as @c Destroyable*
+ inline Destroyable* getBase() const
{
return this->base_;
}
@@ -212,7 +212,7 @@
other.pointer_ = temp;
}
{
- OrxonoxClass* temp = this->base_;
+ Destroyable* temp = this->base_;
this->base_ = other.base_;
other.base_ = temp;
}
@@ -240,7 +240,7 @@
}
private:
- /// Will be called by OrxonoxClass::~OrxonoxClass() if the stored object is deleted. Resets the wrapped pointer and executes the callback.
+ /// Will be called by Destroyable::~Destroyable() if the stored object is deleted. Resets the wrapped pointer and executes the callback.
inline void objectDeleted()
{
this->base_ = 0;
@@ -250,7 +250,7 @@
}
T* pointer_; ///< The wrapped pointer to an object of type @a T
- OrxonoxClass* base_; ///< The wrapped pointer, casted up to OrxonoxClass (this is needed because with just a T* pointer, WeakPtr couln't be used with forward declarations)
+ Destroyable* base_; ///< The wrapped pointer, casted up to Destroyable (this is needed because with just a T* pointer, WeakPtr couln't be used with forward declarations)
FunctorPtr callback_; ///< This callback will be executed if the stored object is deleted
};
Modified: code/branches/core6/src/libraries/util/ScopedSingletonManager.h
===================================================================
--- code/branches/core6/src/libraries/util/ScopedSingletonManager.h 2013-03-24 19:51:37 UTC (rev 9570)
+++ code/branches/core6/src/libraries/util/ScopedSingletonManager.h 2013-03-24 20:03:22 UTC (rev 9571)
@@ -67,7 +67,7 @@
namespace orxonox
{
- class OrxonoxClass;
+ class Destroyable;
/**
@brief Base class of ClassScopedSingletonManager, implements some static functions
@@ -165,8 +165,8 @@
singletonPtr_ = NULL;
}
- //! Destroys the singleton instance - overloaded for OrxonoxClass, calls OrxonoxClass::destroy()
- void destroy(OrxonoxClass*)
+ //! Destroys the singleton instance - overloaded for Destroyable, calls Destroyable::destroy()
+ void destroy(Destroyable*)
{
singletonPtr_->destroy();
}
@@ -245,8 +245,8 @@
}
}
- //! Destroys the singleton instance - overloaded for OrxonoxClass, calls OrxonoxClass::destroy()
- void destroy(OrxonoxClass*)
+ //! Destroys the singleton instance - overloaded for Destroyable, calls Destroyable::destroy()
+ void destroy(Destroyable*)
{
singletonPtr_->destroy();
}
Modified: code/branches/core6/src/orxonox/interfaces/Pickupable.cc
===================================================================
--- code/branches/core6/src/orxonox/interfaces/Pickupable.cc 2013-03-24 19:51:37 UTC (rev 9570)
+++ code/branches/core6/src/orxonox/interfaces/Pickupable.cc 2013-03-24 20:03:22 UTC (rev 9571)
@@ -70,7 +70,7 @@
/**
@brief
- A method that is called by OrxonoxClass::destroy() before the object is actually destroyed.
+ A method that is called by Destroyable::destroy() before the object is actually destroyed.
*/
void Pickupable::preDestroy(void)
{
@@ -97,7 +97,7 @@
void Pickupable::destroyPickup(void)
{
if(!this->isBeingDestroyed())
- this->OrxonoxClass::destroy();
+ this->Destroyable::destroy();
else
orxout(internal_warning, context::pickups) << this->getIdentifier()->getName() << " may be unsafe. " << endl;
}
Modified: code/branches/core6/src/orxonox/interfaces/Pickupable.h
===================================================================
--- code/branches/core6/src/orxonox/interfaces/Pickupable.h 2013-03-24 19:51:37 UTC (rev 9570)
+++ code/branches/core6/src/orxonox/interfaces/Pickupable.h 2013-03-24 20:03:22 UTC (rev 9571)
@@ -143,7 +143,7 @@
void destroy(void); //!< Is called internally within the Pickupable module to destroy pickups.
protected:
- virtual void preDestroy(void); //!< A method that is called by OrxonoxClass::destroy() before the object is actually destroyed.
+ virtual void preDestroy(void); //!< A method that is called by Destroyable::destroy() before the object is actually destroyed.
virtual void destroyPickup(void); //!< Destroys a Pickupable.
virtual void carrierDestroyed(void); //!< Is called by the PickupCarrier when it is being destroyed.
More information about the Orxonox-commit
mailing list