Quick Links:

bal | bbl | bdl | bsl

Public Member Functions

bslma::DeallocatorProctor< ALLOCATOR > Class Template Reference

#include <bslma_deallocatorproctor.h>

List of all members.

Public Member Functions

 DeallocatorProctor (void *memory, ALLOCATOR *allocator)
 ~DeallocatorProctor ()
void release ()
void reset (void *memory)

Detailed Description

template<class ALLOCATOR>
class bslma::DeallocatorProctor< ALLOCATOR >

This class implements a proctor that, unless its release method has previously been invoked, automatically deallocates a block of managed memory upon destruction by invoking the deallocate method of an allocator (or pool) of parameterized ALLOCATOR type supplied to it at construction. The managed memory must have been provided by this allocator (or pool), which must remain valid throughout the lifetime of the proctor object.

See Component bslma_deallocatorproctor


Constructor & Destructor Documentation

template<class ALLOCATOR>
bslma::DeallocatorProctor< ALLOCATOR >::DeallocatorProctor ( void *  memory,
ALLOCATOR *  allocator 
)

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

template<class ALLOCATOR>
bslma::DeallocatorProctor< ALLOCATOR >::~DeallocatorProctor (  ) 

Destroy this deallocator proctor, and deallocate the block of memory it manages (if any) by invoking the deallocate method of the allocator (or pool) that was supplied at construction of this proctor. If no memory is currently being managed, this method has no effect.


Member Function Documentation

template<class ALLOCATOR>
void bslma::DeallocatorProctor< ALLOCATOR >::release (  ) 

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

template<class ALLOCATOR>
void bslma::DeallocatorProctor< ALLOCATOR >::reset ( void *  memory  ) 

Set the specified memory as the block of memory to be managed by this proctor. The behavior is undefined unless memory is non-zero and was allocated by the allocator (or pool) supplied at construction. Note that this method releases any previously-managed memory from management (without deallocating 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: