|
BDE 4.39.x Production Release
|
#include <bslma_deallocatorproctor.h>
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.
Public Member Functions | |
| DeallocatorProctor (void *memory, ALLOCATOR *allocator) | |
| ~DeallocatorProctor () | |
| void | release () |
| void | reset (void *memory) |
|
inline |
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.
allocator is non-zero and supplied memory. allocator must remain valid throughout the lifetime of this proctor.
|
inline |
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.
|
inline |
Release from management the block of memory currently managed by this proctor. If no memory is currently being managed, this method has no effect.
|
inline |
Set the specified memory as the block of memory to be managed by this proctor.
memory is non-zero and was allocated by the allocator (or pool) supplied at construction. release when reusing this object.