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

#include <bslma_sharedptrinplacerep.h>

Inheritance diagram for bslma::SharedPtrInplaceRep< TYPE >:
bslma::SharedPtrRep

Public Member Functions

template<class... ARGS>
 SharedPtrInplaceRep (Allocator *basicAllocator, ARGS &&... args)
 
void disposeObject () BSLS_KEYWORD_OVERRIDE
 
void disposeRep () BSLS_KEYWORD_OVERRIDE
 
void * getDeleter (const std::type_info &type) BSLS_KEYWORD_OVERRIDE
 
TYPE * ptr ()
 
void * originalPtr () const BSLS_KEYWORD_OVERRIDE
 
- 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
 

Additional Inherited Members

- Static Public Member Functions inherited from bslma::SharedPtrRep
static void managedPtrDeleter (void *, void *rep)
 
static void managedPtrEmptyDeleter (void *, void *rep)
 
- Protected Member Functions inherited from bslma::SharedPtrRep
virtual ~SharedPtrRep ()
 

Detailed Description

template<class TYPE>
class bslma::SharedPtrInplaceRep< TYPE >

This class provides a concrete implementation of the SharedPtrRep protocol for "in-place" instances of the parameterized TYPE. Upon destruction of this object, the destructor of TYPE is invoked.

See bslma_sharedptrinplacerep

Constructor & Destructor Documentation

◆ SharedPtrInplaceRep()

template<class TYPE >
template<class... ARGS>
bslma::SharedPtrInplaceRep< TYPE >::SharedPtrInplaceRep ( Allocator basicAllocator,
ARGS &&...  args 
)
explicit

Create a SharedPtrInplaceRep object having an "in-place" instance of the parameterized TYPE using the TYPE constructor that takes the specified arguments, args.... Use the specified basicAllocator to supply memory and, upon a call to disposeRep, to destroy this representation (and the "in-place" shared object). If construction of TYPE with args does not throw, then invocation of this constructor does not throw.

Member Function Documentation

◆ disposeObject()

template<class TYPE >
void bslma::SharedPtrInplaceRep< TYPE >::disposeObject ( )
inlinevirtual

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. Note that this function calls the destructor for the shared object, but does not deallocate its footprint.

Implements bslma::SharedPtrRep.

◆ disposeRep()

template<class TYPE >
void bslma::SharedPtrInplaceRep< TYPE >::disposeRep ( )
inlinevirtual

Deallocate the memory associated with this representation object (including the shared object's footprint). 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 >
void * bslma::SharedPtrInplaceRep< TYPE >::getDeleter ( const std::type_info &  type)
inlinevirtual

Return a null pointer. Note that the specified type is not used as an in-place representation for a shared pointer can never store a user-supplied deleter (there is no function that might try to create one).

Implements bslma::SharedPtrRep.

◆ originalPtr()

template<class TYPE >
void * bslma::SharedPtrInplaceRep< TYPE >::originalPtr ( ) const
inlinevirtual

Return the (untyped) address of the modifiable (in-place) object referred to by this representation object.

Implements bslma::SharedPtrRep.

◆ ptr()

template<class TYPE >
TYPE * bslma::SharedPtrInplaceRep< TYPE >::ptr ( )
inline

Return the address of the modifiable (in-place) object referred to by this representation object.


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