Quick Links:

bal | bbl | bdl | bsl

Public Member Functions

bslma::RawDeleterProctor< TYPE, ALLOCATOR > Class Template Reference

#include <bslma_rawdeleterproctor.h>

List of all members.

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 Component bslma_rawdeleterproctor


Constructor & Destructor Documentation

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

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.

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

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

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

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

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

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: