[#BloombergLP-bslma-SharedPtrRep]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::SharedPtrRep
:relfileprefix: ../../
:mrdocs:

Partially implemented shared pointer representation protocol&period;

== Synopsis

Declared in `&lt;bslma&lowbar;sharedptrrep&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class SharedPtrRep;
----

== Description

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

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslma/SharedPtrRep/2constructor.adoc[`SharedPtrRep`]         [.small]#[constructor]#
| Create a `SharedPtrRep` object having one shared reference and no weak references&period;
| xref:BloombergLP/bslma/SharedPtrRep/acquireRef.adoc[`acquireRef`] 
| Atomically acquire a shared reference to the shared object referred to by this representation&period; The behavior is undefined unless `0 &lt; numReferences()`&period;
| xref:BloombergLP/bslma/SharedPtrRep/acquireWeakRef.adoc[`acquireWeakRef`] 
| Atomically acquire a weak reference to the shared object&period;
| xref:BloombergLP/bslma/SharedPtrRep/disposeObject.adoc[`disposeObject`]  [.small]#[virtual]#
| Dispose of the shared object referred to by this representation&period;
| xref:BloombergLP/bslma/SharedPtrRep/disposeRep.adoc[`disposeRep`]  [.small]#[virtual]#
| Dispose of this representation object&period;
| xref:BloombergLP/bslma/SharedPtrRep/getDeleter.adoc[`getDeleter`]  [.small]#[virtual]#
| Return a pointer to the stored deleter of the specified type&period;
| xref:BloombergLP/bslma/SharedPtrRep/hasUniqueOwner.adoc[`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&period;
| xref:BloombergLP/bslma/SharedPtrRep/incrementRefs.adoc[`incrementRefs`] 
| Atomically increment the number of shared references&period;
| xref:BloombergLP/bslma/SharedPtrRep/numReferences.adoc[`numReferences`] 
| Return a &quot;snapshot&quot; of the current number of shared references to the shared object referred to by this representation object&period;
| xref:BloombergLP/bslma/SharedPtrRep/numWeakReferences.adoc[`numWeakReferences`] 
| Return a &quot;snapshot&quot; of the current number of weak references to the shared object referred to by this representation object&period;
| xref:BloombergLP/bslma/SharedPtrRep/originalPtr.adoc[`originalPtr`]  [.small]#[virtual]#
| Return the (untyped) address of the modifiable shared object referred to by this representation&period;
| xref:BloombergLP/bslma/SharedPtrRep/releaseRef.adoc[`releaseRef`] 
| Atomically release a shared reference to the shared object&period;
| xref:BloombergLP/bslma/SharedPtrRep/releaseWeakRef.adoc[`releaseWeakRef`] 
| Atomically release a weak reference to the shared object&period;
| xref:BloombergLP/bslma/SharedPtrRep/resetCountsRaw.adoc[`resetCountsRaw`] 
| Reset the shared and weak reference counts to the specified values&period;
| xref:BloombergLP/bslma/SharedPtrRep/tryAcquireRef.adoc[`tryAcquireRef`] 
| Try to atomically acquire a shared reference to the shared object&period;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslma/SharedPtrRep/managedPtrDeleter.adoc[`managedPtrDeleter`] 
| Release the shared reference held by the specified representation&period;
| xref:BloombergLP/bslma/SharedPtrRep/managedPtrEmptyDeleter.adoc[`managedPtrEmptyDeleter`] 
| Deleter that has no effect when converting a null shared pointer&period;
|===


== Protected Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslma/SharedPtrRep/2destructor.adoc[`&#126;SharedPtrRep`] [.small]#[destructor]# [.small]#[virtual]#
| Destroy this representation object&period;
|===


== Derived Classes

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlcc/SharedObjectPool_Rep.adoc[`SharedObjectPool&lowbar;Rep`] 
| Shared pointer representation object used by `SharedObjectPool`&period;
| xref:BloombergLP/bslstl/SharedPtrAllocateInplaceRep.adoc[`SharedPtrAllocateInplaceRep`] 
| In&hyphen;place `SharedPtrRep` implementation for a managed object of `TYPE`&period;
| xref:BloombergLP/bslstl/SharedPtrAllocateOutofplaceRep.adoc[`SharedPtrAllocateOutofplaceRep`] 
| Out&hyphen;of&hyphen;place concrete implementation of the `SharedPtrRep` protocol&period;
| xref:BloombergLP/bslstl/SharedPtrArrayAllocateInplaceRep.adoc[`SharedPtrArrayAllocateInplaceRep`] 
| In&hyphen;place `SharedPtrRep` implementation for a managed array of `TYPE`&period;
| xref:BloombergLP/bslma/SharedPtrInplaceRep.adoc[`SharedPtrInplaceRep`] 
| In&hyphen;place `SharedPtrRep` implementation for a managed object of `TYPE`&period;
| xref:BloombergLP/bslma/SharedPtrOutofplaceRep.adoc[`SharedPtrOutofplaceRep`] 
| Out&hyphen;of&hyphen;place concrete implementation of the `SharedPtrRep` protocol&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
