te::common::Decorator< T > Class Template Reference

#include <Decorator.h>

Inheritance diagram for te::common::Decorator< T >:

Public Member Functions

 Decorator (T *decorated, bool deleteDecorated=false)
 Constructor. More...
 
 Decorator (const Decorator &rhs)
 Copy constructor. More...
 
T * findDecorator (T *decorated)
 Returns the Decorator that decorates this item. More...
 
T * getDecorated ()
 Returns the pointer of decorated object. More...
 
Decoratoroperator= (const Decorator &rhs)
 Copy operator. More...
 
T * removeDecorator (T *decorated)
 Removes The decorator of the decorated. More...
 
virtual ~Decorator ()
 Virtual destructor. More...
 

Protected Attributes

T * m_decorated
 The object decorated. More...
 
bool m_delDecorated
 If true, also delete decorated pointer. More...
 

Detailed Description

template<class T>
class te::common::Decorator< T >

Decorators are classes that can change object behavioral in run-time. For more informations about decorator pattern, see: Decorator pattern on Wikipedia.

Definition at line 42 of file Decorator.h.

Constructor & Destructor Documentation

template<class T>
te::common::Decorator< T >::Decorator ( T *  decorated,
bool  deleteDecorated = false 
)

Constructor.

The deleteDecorated argument tells if the decorator HAS or NOT the ownership of the decorated pointer. A true value gives the ownership to the decorator and the client do not need manage memory of the decorated pointer. Otherwise, the client needs manage the memory of the decorated pointer.

Parameters
decoratedThe object to be decorated.
deleteDecoratedTells to decorator to also delete decorated pointer.

Definition at line 103 of file Decorator.h.

template<class T >
te::common::Decorator< T >::~Decorator ( )
virtual

Virtual destructor.

Definition at line 111 of file Decorator.h.

template<class T>
te::common::Decorator< T >::Decorator ( const Decorator< T > &  rhs)

Copy constructor.

Parameters
rhsObject to be copied.

Definition at line 118 of file Decorator.h.

Member Function Documentation

template<class T>
T * te::common::Decorator< T >::findDecorator ( T *  decorated)

Returns the Decorator that decorates this item.

Parameters
decoratedThe decorated item that we are looking for.
Returns
The Decorator we are looking for or this if there's no decorators or 0 if not found.

Definition at line 140 of file Decorator.h.

template<class T >
T * te::common::Decorator< T >::getDecorated ( )

Returns the pointer of decorated object.

Definition at line 134 of file Decorator.h.

template<class T >
Decorator< T > & te::common::Decorator< T >::operator= ( const Decorator< T > &  rhs)

Copy operator.

Parameters
rhsObject to be copied.

Definition at line 125 of file Decorator.h.

References te::common::Decorator< T >::m_decorated, and te::common::Decorator< T >::m_delDecorated.

template<class T>
T * te::common::Decorator< T >::removeDecorator ( T *  decorated)

Removes The decorator of the decorated.

Parameters
decoratedThe item that we are searching for the decorator.
Returns
The new item to be used as new Delegate or NULL.

Definition at line 154 of file Decorator.h.

References te::common::Decorator< T >::m_decorated, and te::common::Decorator< T >::m_delDecorated.

Member Data Documentation

template<class T>
T* te::common::Decorator< T >::m_decorated
protected

The object decorated.

Definition at line 98 of file Decorator.h.

Referenced by te::common::Decorator< T >::operator=(), and te::common::Decorator< T >::removeDecorator().

template<class T>
bool te::common::Decorator< T >::m_delDecorated
protected

If true, also delete decorated pointer.

Definition at line 99 of file Decorator.h.

Referenced by te::common::Decorator< T >::operator=(), and te::common::Decorator< T >::removeDecorator().


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