Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

MangoPtrPrivateNamespace::PtrUsageSharing Class Reference

#include <PtrUsageSharing.hh>

Inheritance diagram for MangoPtrPrivateNamespace::PtrUsageSharing:

Inheritance graph
[legend]
Collaboration diagram for MangoPtrPrivateNamespace::PtrUsageSharing:

Collaboration graph
[legend]
List of all members.

Detailed Description

Base class that encapsulates the use of a validator to track the usage validity of an owned pointer (as opposed to tracking the ownership validity of the owned pointer).

For performance, the validator is not initialized to the validity state of the pointer it is tracking, until required, which typically is just before being copied the first time. This base class manages this complexity, and must be derived to be instantiated. The derived class will typically override the protected methods of PtrUsageSharing but call them implicitly. Implementation-wise, all this class does is make sure that before copying or assignment occur, that the validity object has been initialized with the validity state of the pointer.

Definition at line 47 of file PtrUsageSharing.hh.

Public Methods

void invalidateUsage ()
 Set validity to false.

void unlinkNew ()
 Reset to default state, ie. like from default constructor.

const MangoPtr::ValidityOwnerusage () const
 Get the validator.


Protected Methods

 PtrUsageSharing ()
 Default constructor.

 PtrUsageSharing (const PtrUsageSharing &rhs)
 Copy constructor.

void operator= (const PtrUsageSharing &rhs)
 Assignment operator.

void swap (PtrUsageSharing &rhs)
 Swap two objects of this type.

void setFrom (void *optr)
 Set the usage validity state based on optr.

bool wasUsageInitialized () const
 Has the usage validator been initialized.


Protected Attributes

MangoPtr::ValidityOwner usageVal
 the usage validator


Member Function Documentation

const MangoPtr::ValidityOwner& MangoPtrPrivateNamespace::PtrUsageSharing::usage   const [inline]
 

Get the validator.

Must not be called before the validator has had its validity state set at least once. This is done by calling a method from the derived class that calls setFrom().

Definition at line 103 of file PtrUsageSharing.hh.

References usageVal.

void MangoPtrPrivateNamespace::PtrUsageSharing::setFrom void *    optr [inline, protected]
 

Set the usage validity state based on optr.

The latter is used only when the validator has never been initialized. Otherwise, it is assumed that the usage validity is changed only with invalidateUsage(). This operator must be called at least once(by subclass) before copy/assign of PtrUsageSharing can be done.

Definition at line 117 of file PtrUsageSharing.hh.

References MangoPtr::ValidityOwner::setValid(), and usageVal.

Referenced by MangoPtr::ObjSharing< OShared >::operator()().


The documentation for this class was generated from the following file:
Generated on Tue Nov 12 20:44:04 2002 for Mango-ptr Library by doxygen1.2.18