Loki::LockedStorage< T > Class Template Reference
[Storage policies]
#include <SmartPtr.h>
List of all members.
|  | 
| 
 Public Types | 
| 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* 
 | 
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.
- Note:
- 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. 
The documentation for this class was generated from the following file: