Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Private Member Functions | Private Attributes | List of all members
orxonox::DestructionHelper< T > Class Template Reference

Utility class that helps to create a special kind of destructor that also executes if the destruction fails. More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/util/DestructionHelper.h>

Public Member Functions

 DestructionHelper (T *object)
 
 ~DestructionHelper ()
 

Private Member Functions

 DestructionHelper (const DestructionHelper &)=delete
 
DestructionHelperoperator= (const DestructionHelper &)=delete
 

Private Attributes

T * object_
 

Detailed Description

template<class T>
class orxonox::DestructionHelper< T >

Utility class that helps to create a special kind of destructor that also executes if the destruction fails.

This helps a lot to improve exception handling.

Example:

class MyClass
{
public:
MyClass() : destructionHelper_(this)
{
// Do something that might throw
}
~MyClass()
{
// Keep empty!
}
void destroy()
{
// Place your destruction code here instead
}
private:
};

Constructor & Destructor Documentation

template<class T>
orxonox::DestructionHelper< T >::DestructionHelper ( T *  object)
inline
template<class T>
orxonox::DestructionHelper< T >::~DestructionHelper ( )
inline
template<class T>
orxonox::DestructionHelper< T >::DestructionHelper ( const DestructionHelper< T > &  )
privatedelete

Member Function Documentation

template<class T>
DestructionHelper& orxonox::DestructionHelper< T >::operator= ( const DestructionHelper< T > &  )
privatedelete

Member Data Documentation

template<class T>
T* orxonox::DestructionHelper< T >::object_
private

The documentation for this class was generated from the following file: