Loki::FunctionStorage< T > Class Template Reference
[Storage policies]

Implementation of the StoragePolicy used by SmartPtr. More...

#include <SPCachedFactory.h>

Collaboration diagram for Loki::FunctionStorage< T >:

List of all members.

Public Types

typedef T * StoredType
 the type of the pointee_ object
typedef T * InitPointerType
 type used to declare OwnershipPolicy type.
typedef T * PointerType
 type returned by operator->
typedef T & ReferenceType
 type returned by operator*
typedef Functor< void, Seq<
void * > > 
 type of the Functor to set

Public Member Functions

 FunctionStorage ()
 FunctionStorage (const FunctionStorage &rsh)
template<class U>
 FunctionStorage (const FunctionStorage< U > &rsh)
 FunctionStorage (const StoredType &p)
PointerType operator-> () const
ReferenceType operator * () const
void Swap (FunctionStorage &rhs)
void SetCallBackFunction (const FunctorType &functor)

Protected Member Functions

void Destroy ()

Static Protected Member Functions

static StoredType Default ()

Detailed Description

template<class T>
class Loki::FunctionStorage< T >

Implementation of the StoragePolicy used by SmartPtr.

This storage policy is used by SmartPointer CachedFactory's encapsulation policy. It's purpose is to call a Functor instead of deleting the underlying pointee object. You have to set the callback functor by calling SetCallBackFunction(const FunctorType &functor).

Unfortunately, the functor argument is not a reference to the SmartPtr but a void *. Making functor argument a reference to the pointer would require the FunctionStorage template to know the full definition of the SmartPtr.

Definition at line 62 of file SPCachedFactory.h.

Member Function Documentation

template<class T>
void Loki::FunctionStorage< T >::SetCallBackFunction ( const FunctorType functor  )  [inline]

Sets the callback function to call. You have to specify it or the smartPtr will throw a bad_function_call exception.

Definition at line 102 of file SPCachedFactory.h.

The documentation for this class was generated from the following file:
Generated on Sun Feb 25 16:52:48 2007 for Loki by  doxygen 1.5.1-p1