BDE 4.14.0 Production release
|
#include <bslma_deallocatebytesproctor.h>
Public Member Functions | |
DeallocateBytesProctor (const ALLOCATOR &allocator, PtrType p, std::size_t nbytes, std::size_t alignment=k_MAX_ALIGNMENT) | |
DeallocateBytesProctor (bslmf::MovableRef< DeallocateBytesProctor > original) | |
~DeallocateBytesProctor () | |
PtrType | release () |
void | reset (PtrType p, std::size_t nbytes, std::size_t alignment=k_MAX_ALIGNMENT) |
PtrType | ptr () const |
This class implements a proctor that, unless its release
method has previously been invoked, automatically deallocates a managed block of 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 block must have been provided by the supplied allocator (or pool); the allocator (or pool) 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 the same deallocation interface as bslma::Allocator
.
|
inline |
Create a proctor to manage the specified nbytes
bytes at the specified p
address, which have been allocated from the specified allocator
. Optionally specify the alignment
used to allocate the bytes. If p
is null, then the created proctor is disengaged (manages no memory). The behavior is undefined unless p
is null or was allocated from allocator
with a size of nbytes
and alignment of alignment
.
|
inline |
This move constructor creates a proctor managing the same block as original
. After the move, original
is disengaged.
|
inline |
Deallocate the managed memory, if any, without invoking any other destructors.
|
inline |
Return the address of the currently managed memory block, if engaged; otherwise return a null pointer.
|
inline |
Disengage this allocator and return a pointer to the formerly managed memory block.
|
inline |
Release the managed memory and reset this proctor to manage the specified nbytes
bytes at the specified p
address. Optionally specify the alignment
used to allocate p
. If p
is null, then the proctor is disengaged (manages no memory). The behavior is undefined unless p
is null or was allocated with a size of nbytes
and alignment of alignment
from the same allocator used to construct this proctor. Note that the previously managed block is not deallocated.