#include <SPCachedFactory.h>
Collaboration diagram for Loki::FunctionStorage< T >:
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 * > > | FunctorType |
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 () |
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.
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.