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

#include <bslma_rawdeleterproctor.h>

Public Member Functions

 RawDeleterProctor (TYPE *object, ALLOCATOR *allocator)
 
 ~RawDeleterProctor ()
 
void release ()
 
void reset (TYPE *object)
 

Detailed Description

template<class TYPE, class ALLOCATOR>
class bslma::RawDeleterProctor< TYPE, ALLOCATOR >

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.

See bslma_rawdeleterproctor

Constructor & Destructor Documentation

◆ RawDeleterProctor()

template<class TYPE , class ALLOCATOR >
bslma::RawDeleterProctor< TYPE, ALLOCATOR >::RawDeleterProctor ( TYPE *  object,
ALLOCATOR *  allocator 
)
inline

Create a raw deleter proctor that conditionally manages the specified object (if non-zero), and that uses the specified allocator to delete the object managed by this proctor (if not released – see release) upon destruction. The behavior is undefined unless allocator is non-zero and supplied the memory for object (if non-zero). Note that allocator must remain valid throughout the lifetime of this proctor.

◆ ~RawDeleterProctor()

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

Destroy this raw deleter proctor, and delete the object it manages (if any) by first invoking the destructor of the (managed) object, and then invoking the deallocate method of the allocator (or pool) that was supplied at the construction of this proctor. If no object is currently being managed, this method has no effect.

Member Function Documentation

◆ release()

template<class TYPE , class ALLOCATOR >
void bslma::RawDeleterProctor< TYPE, ALLOCATOR >::release ( )
inline

Release from management the object currently managed by this proctor. If no object is currently being managed, this method has no effect.

◆ reset()

template<class TYPE , class ALLOCATOR >
void bslma::RawDeleterProctor< TYPE, ALLOCATOR >::reset ( TYPE *  object)
inline

Set the specified object as the object to be managed by this proctor. The behavior is undefined unless object is non-zero and was allocated from the allocator (or pool) supplied at construction. Note that this method releases any previously-managed object from management (without deleting it), and so may be invoked with or without having called release when reusing this object.


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