BloombergLP::bdlma::BufferManager::replaceBuffer

Replace the managed buffer with newBuffer of newBufferSize.

Synopsis

Declared in <bdlma_buffermanager.h>

char*
replaceBuffer(
    char* newBuffer,
    bsls::Types::size_type newBufferSize);

Description

Replace the buffer currently managed by this object with the specified newBuffer of the specified newBufferSize (in bytes); return the address of the previously held buffer, or 0 if this object currently manages no buffer. The replaced buffer (if any) is removed from the management of this object with no effect on the outstanding allocated memory blocks. Subsequent allocations will allocate memory from the beginning of the new external buffer. The behavior is undefined unless 0 < newBufferSize and newBuffer has at least newBufferSize bytes.

Return Value

address of the previously held buffer, or 0 if this object currently manages no buffer

Parameters

NameDescription
newBufferexternal buffer to manage
newBufferSizesize in bytes of newBuffer