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

#include <SmartPtr.h>

List of all members.

Public Types

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

Public Member Functions

 LockedStorage ()
 type returned by operator*
 ~LockedStorage (void)
 LockedStorage (const LockedStorage &)
 LockedStorage (const StoredType &p)
PointerType operator-> ()
void Swap (LockedStorage &rhs)

Protected Member Functions

void Destroy ()

Static Protected Member Functions

static StoredType Default ()

Detailed Description

template<class T>
class Loki::LockedStorage< T >

Implementation of the StoragePolicy used by SmartPtr.

Each call to operator-> locks the object for the duration of a call to a member function of T.

How It Works
LockedStorage has a helper class called Locker, which acts as a smart pointer with limited abilities. LockedStorage::operator-> returns an unnamed temporary of type Locker<T> that exists for the duration of the call to a member function of T. The unnamed temporary locks the object when it is constructed by operator-> and unlocks the object when it is destructed.
This storage policy requires class T to have member functions Lock and Unlock. If your class does not have Lock or Unlock functions, you may either make a child class which does, or make a policy class similar to LockedStorage which calls other functions to lock the object.

Definition at line 274 of file SmartPtr.h.

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