BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslma::SharedPtrOutofplaceRep< TYPE, DELETER > Class Template Reference

#include <bslma_sharedptroutofplacerep.h>

Inheritance diagram for bslma::SharedPtrOutofplaceRep< TYPE, DELETER >:
bslma::SharedPtrRep

Public Member Functions

void disposeObject () BSLS_KEYWORD_OVERRIDE
 
void disposeRep () BSLS_KEYWORD_OVERRIDE
 
void * getDeleter (const std::type_info &type) BSLS_KEYWORD_OVERRIDE
 
void * originalPtr () const BSLS_KEYWORD_OVERRIDE
 
TYPE * ptr () const
 
- Public Member Functions inherited from bslma::SharedPtrRep
 SharedPtrRep ()
 
void acquireRef ()
 
void acquireWeakRef ()
 
void incrementRefs (int incrementAmount=1)
 
void releaseRef ()
 
void releaseWeakRef ()
 
void resetCountsRaw (int numSharedReferences, int numWeakReferences)
 
bool tryAcquireRef ()
 
bool hasUniqueOwner () const
 
int numReferences () const
 
int numWeakReferences () const
 

Static Public Member Functions

static SharedPtrOutofplaceRep< TYPE, DELETER > * makeOutofplaceRep (TYPE *ptr, const DELETER &deleter, Allocator *basicAllocator=0)
 
- Static Public Member Functions inherited from bslma::SharedPtrRep
static void managedPtrDeleter (void *, void *rep)
 
static void managedPtrEmptyDeleter (void *, void *rep)
 

Additional Inherited Members

- Protected Member Functions inherited from bslma::SharedPtrRep
virtual ~SharedPtrRep ()
 

Detailed Description

template<class TYPE, class DELETER>
class bslma::SharedPtrOutofplaceRep< TYPE, DELETER >

This class provides a concrete implementation of the SharedPtrRep protocol for out-of-place instances of the parameterized TYPE. Upon destruction of this object, the parameterized DELETER type is invoked on the pointer to the shared object.

See bslma_sharedptroutofplacerep

Member Function Documentation

◆ disposeObject()

template<class TYPE , class DELETER >
void bslma::SharedPtrOutofplaceRep< TYPE, DELETER >::disposeObject ( )
virtual

Destroy the object being referred to by this representation. This method is automatically invoked by releaseRef when the number of shared references reaches zero and should not be explicitly invoked otherwise.

Implements bslma::SharedPtrRep.

◆ disposeRep()

template<class TYPE , class DELETER >
void bslma::SharedPtrOutofplaceRep< TYPE, DELETER >::disposeRep ( )
inlinevirtual

Destroy this representation object and deallocate the associated memory. This method is automatically invoked by releaseRef and releaseWeakRef when the number of weak references and the number of shared references both reach zero and should not be explicitly invoked otherwise. The behavior is undefined unless disposeObject has already been called for this representation. Note that this disposeRep method effectively serves as the representation object's destructor.

Implements bslma::SharedPtrRep.

◆ getDeleter()

template<class TYPE , class DELETER >
void * bslma::SharedPtrOutofplaceRep< TYPE, DELETER >::getDeleter ( const std::type_info &  type)
inlinevirtual

Return a pointer to the deleter stored by the derived representation (if any) if the deleter has the same type as that described by the specified type, and a null pointer otherwise.

Implements bslma::SharedPtrRep.

◆ makeOutofplaceRep()

template<class TYPE , class DELETER >
SharedPtrOutofplaceRep< TYPE, DELETER > * bslma::SharedPtrOutofplaceRep< TYPE, DELETER >::makeOutofplaceRep ( TYPE *  ptr,
const DELETER &  deleter,
Allocator basicAllocator = 0 
)
static

Return the address of a newly created SharedPtrOutofplaceRep object that manages the lifetime of the specified ptr, using the specified deleter to destroy ptr. Optionally, specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. Note that the parameterized DELETER type will be used to deallocate the memory pointed to by ptr.

◆ originalPtr()

template<class TYPE , class DELETER >
void * bslma::SharedPtrOutofplaceRep< TYPE, DELETER >::originalPtr ( ) const
inlinevirtual

Return the (untyped) address of the modifiable shared object to which this object refers.

Implements bslma::SharedPtrRep.

◆ ptr()

template<class TYPE , class DELETER >
TYPE * bslma::SharedPtrOutofplaceRep< TYPE, DELETER >::ptr ( ) const
inline

Return the address of the modifiable shared object to which this object refers.


The documentation for this class was generated from the following file: