Partially implemented shared pointer representation protocol.

Synopsis

Declared in <bslma_sharedptrrep.h>

class SharedPtrRep;

Description

This class provides a partially implemented shared pointer representation ("letter") protocol. The class provides two counters for storing the number of shared and weak references, and functions to increment and decrement these counters. In addition, this class provides protocol methods that allow concrete implementations to specify what action should be taken when these counts reach zero. The function disposeRep is responsible for destroying this object, it is called when the reference count to this object reaches zero. Thus, the destructor of this object is declared as protected and should never be invoked.

Member Functions

Name

Description

SharedPtrRep [constructor]

Create a SharedPtrRep object having one shared reference and no weak references.

acquireRef

Atomically acquire a shared reference to the shared object referred to by this representation. The behavior is undefined unless 0 < numReferences().

acquireWeakRef

Atomically acquire a weak reference to the shared object.

disposeObject [virtual]

Dispose of the shared object referred to by this representation.

disposeRep [virtual]

Dispose of this representation object.

getDeleter [virtual]

Return a pointer to the stored deleter of the specified type.

hasUniqueOwner

Return true if there is only one shared reference and no weak references to the object referred to by this representation, and false otherwise.

incrementRefs

Atomically increment the number of shared references.

numReferences

Return a "snapshot" of the current number of shared references to the shared object referred to by this representation object.

numWeakReferences

Return a "snapshot" of the current number of weak references to the shared object referred to by this representation object.

originalPtr [virtual]

Return the (untyped) address of the modifiable shared object referred to by this representation.

releaseRef

Atomically release a shared reference to the shared object.

releaseWeakRef

Atomically release a weak reference to the shared object.

resetCountsRaw

Reset the shared and weak reference counts to the specified values.

tryAcquireRef

Try to atomically acquire a shared reference to the shared object.

Static Member Functions

Name

Description

managedPtrDeleter

Release the shared reference held by the specified representation.

managedPtrEmptyDeleter

Deleter that has no effect when converting a null shared pointer.

Protected Member Functions

Name

Description

~SharedPtrRep [destructor] [virtual]

Destroy this representation object.

Derived Classes

Name

Description

SharedObjectPool_Rep

Shared pointer representation object used by SharedObjectPool.

SharedPtrAllocateInplaceRep

In‐place SharedPtrRep implementation for a managed object of TYPE.

SharedPtrAllocateOutofplaceRep

Out‐of‐place concrete implementation of the SharedPtrRep protocol.

SharedPtrArrayAllocateInplaceRep

In‐place SharedPtrRep implementation for a managed array of TYPE.

SharedPtrInplaceRep

In‐place SharedPtrRep implementation for a managed object of TYPE.

SharedPtrOutofplaceRep

Out‐of‐place concrete implementation of the SharedPtrRep protocol.

Created with MrDocs