tDecorator< DecoratedDerived, Decoration > Class Template Reference

decorates a decoratable object with a decoration More...

#include <tDecorator.h>

Inheritance diagram for tDecorator< DecoratedDerived, Decoration >:

Inheritance graph
[legend]
Collaboration diagram for tDecorator< DecoratedDerived, Decoration >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef
DecoratedDerived::Decoratable_ 
Decorated
 typedef for the class that is registered with the decorator system

Public Member Functions

 tDecorator ()
 constructor, allocating the space
Decoration & Get (Decorated &object)
 gets the decorator

Private Member Functions

virtual size_t GetSize () const
virtual void Construct (void *decoration) const
virtual void Destruct (void *decoration) const


Detailed Description

template<class DecoratedDerived, class Decoration>
class tDecorator< DecoratedDerived, Decoration >

decorates a decoratable object with a decoration

Definition at line 244 of file tDecorator.h.


Member Typedef Documentation

template<class DecoratedDerived, class Decoration>
typedef DecoratedDerived::Decoratable_ tDecorator< DecoratedDerived, Decoration >::Decorated

typedef for the class that is registered with the decorator system

Definition at line 248 of file tDecorator.h.


Constructor & Destructor Documentation

template<class DecoratedDerived, class Decoration>
tDecorator< DecoratedDerived, Decoration >::tDecorator (  )  [inline]

constructor, allocating the space

Definition at line 251 of file tDecorator.h.

References tDecoratableManagerBase::AddDecorator(), and tDecoratableManager< Decorated >::GetManager().

00252     {
00253         tDecoratableManager< Decorated > & manager = tDecoratableManager< Decorated >::GetManager();
00254 
00255         // insert into management list
00256         manager.AddDecorator( *this );
00257     }

Here is the call graph for this function:


Member Function Documentation

template<class DecoratedDerived, class Decoration>
Decoration& tDecorator< DecoratedDerived, Decoration >::Get ( Decorated object  )  [inline]

gets the decorator

Definition at line 260 of file tDecorator.h.

00261     {
00262         // pointer magic to get to the place of the decoration in decorator spacew
00263         char * endOfPointerSpace = static_cast< char * >( static_cast< void * >( &object ) );
00264         char * allocatedSlot     = endOfPointerSpace - offset_;
00265         Decoration * decoration = static_cast< Decoration * >( static_cast< void * >( allocatedSlot ) );
00266 
00267         return * decoration;
00268     }

template<class DecoratedDerived, class Decoration>
virtual size_t tDecorator< DecoratedDerived, Decoration >::GetSize (  )  const [inline, private, virtual]

Implements tDecoratorBase.

Definition at line 270 of file tDecorator.h.

00270 { return sizeof( Decoration ); }

template<class DecoratedDerived, class Decoration>
virtual void tDecorator< DecoratedDerived, Decoration >::Construct ( void *  decoration  )  const [inline, private, virtual]

Implements tDecoratorBase.

Reimplemented in tDecoratorPOD< DecoratedDerived, Decoration >.

Definition at line 272 of file tDecorator.h.

00273     {
00274         new(decoration) Decoration;
00275     }

template<class DecoratedDerived, class Decoration>
virtual void tDecorator< DecoratedDerived, Decoration >::Destruct ( void *  decoration  )  const [inline, private, virtual]

Implements tDecoratorBase.

Definition at line 277 of file tDecorator.h.

00278     {
00279         static_cast< Decoration * >( decoration )->~Decoration();
00280     }


The documentation for this class was generated from the following file:
Generated on Sat Mar 15 23:56:07 2008 for Armagetron Advanced by  doxygen 1.5.4