Loki  0.1.7
Loki::FunctionStorage< T > Class Template Reference

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

#include <SPCachedFactory.h>

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

void SetCallBackFunction (const FunctorType &functor)
 

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.

Member Function Documentation

◆ SetCallBackFunction()

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.


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