#include <PtrUsageSharing.hh>
Inheritance diagram for MangoPtrPrivateNamespace::PtrUsageSharing:
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::ValidityOwner & | usage () 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 |
|
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. |
|
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()(). |