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

#include <bslma_deleteobjectproctor.h>

Public Member Functions

 DeleteObjectProctor (const ALLOCATOR &allocator, PtrType p)
 
 DeleteObjectProctor (bslmf::MovableRef< DeleteObjectProctor > original)
 
 ~DeleteObjectProctor ()
 Destroy and deallocate the managed object, if any.
 
PtrType release ()
 
void reset (PtrType p)
 
PtrType ptr () const
 

Detailed Description

template<class ALLOCATOR, class TYPE = typename ALLOCATOR::value_type>
class bslma::DeleteObjectProctor< ALLOCATOR, TYPE >

This class implements a proctor that, unless its release method has previously been invoked, automatically deletes a managed object upon destruction by first invoking the object's destructor, and then invoking the deallocate method of an allocator (or pool) of parameterized ALLOCATOR type supplied to it at construction. The managed object of parameterized TYPE must have been created using memory provided by this allocator (or pool), which must remain valid throughout the lifetime of the proctor object. If ALLOCATOR is a non-pointer type, it is assumed to be STL compatible; otherwise, it is assumed have a deallocate method with a single void * parameter, i.e., the same deallocation interface as bslma::Allocator.

See bslma_deleteobjectproctor

Constructor & Destructor Documentation

◆ DeleteObjectProctor() [1/2]

template<class ALLOCATOR , class TYPE >
bslma::DeleteObjectProctor< ALLOCATOR, TYPE >::DeleteObjectProctor ( const ALLOCATOR &  allocator,
PtrType  p 
)
inline

Create a proctor to manage the specified p object, which has been allocated from the specified allocator. If p is null, then the created proctor is disengaged (manages no object). The behavior is undefined if p is non-null but not allocated from allocator.

◆ DeleteObjectProctor() [2/2]

template<class ALLOCATOR , class TYPE >
bslma::DeleteObjectProctor< ALLOCATOR, TYPE >::DeleteObjectProctor ( bslmf::MovableRef< DeleteObjectProctor< ALLOCATOR, TYPE > >  original)
inline

This move constructor creates a proctor managing the same object as original. After the move, original is disengaged.

◆ ~DeleteObjectProctor()

template<class ALLOCATOR , class TYPE >
bslma::DeleteObjectProctor< ALLOCATOR, TYPE >::~DeleteObjectProctor ( )
inline

Member Function Documentation

◆ ptr()

template<class ALLOCATOR , class TYPE >
DeleteObjectProctor< ALLOCATOR, TYPE >::PtrType bslma::DeleteObjectProctor< ALLOCATOR, TYPE >::ptr ( ) const
inline

◆ release()

template<class ALLOCATOR , class TYPE >
DeleteObjectProctor< ALLOCATOR, TYPE >::PtrType bslma::DeleteObjectProctor< ALLOCATOR, TYPE >::release ( )
inline

Disengage this allocator and return a pointer to the formerly managed object.

◆ reset()

template<class ALLOCATOR , class TYPE >
void bslma::DeleteObjectProctor< ALLOCATOR, TYPE >::reset ( PtrType  p)
inline

Release the managed object and reset this proctor to manage the specified p object. If p is null, the proctor will be disengaged. Note that the previously managed object is not destroyed or deallocated.


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