From: <ric...@us...> - 2006-11-29 19:16:41
|
Revision: 790 http://svn.sourceforge.net/loki-lib/?rev=790&view=rev Author: rich_sposato Date: 2006-11-29 11:16:39 -0800 (Wed, 29 Nov 2006) Log Message: ----------- Added documentation comments for LockedStorage policy. Modified Paths: -------------- trunk/include/loki/SmartPtr.h Modified: trunk/include/loki/SmartPtr.h =================================================================== --- trunk/include/loki/SmartPtr.h 2006-11-27 20:45:39 UTC (rev 789) +++ trunk/include/loki/SmartPtr.h 2006-11-29 19:16:39 UTC (rev 790) @@ -220,9 +220,29 @@ /// /// \ingroup SmartPointerStorageGroup /// Implementation of the StoragePolicy used by SmartPtr. -/// Requires class T to have member functions Lock and Unlock. +/// +/// Each call to operator-> locks the object for the duration of a call to a +/// member function of T. +/// +/// \par 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. //////////////////////////////////////////////////////////////////////////////// + template <class T> + class LockedStorage + { + public: + template <class T> class Locker { @@ -255,11 +275,6 @@ T * pointee_; }; - template <class T> - class LockedStorage - { - public: - typedef T* StoredType; /// the type of the pointee_ object typedef T* InitPointerType; /// type used to declare OwnershipPolicy type. typedef Locker< T > PointerType; /// type returned by operator-> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |