BloombergLP::bdlbb::BlobUtil::getContiguousDataBuffer

Grow a blob and return contiguous storage for the newly added bytes.

Synopsis

Declared in <bdlbb_blobutil.h>

static
char*
getContiguousDataBuffer(
    Blob* blob,
    int addLength,
    BlobBufferFactory* factory);

Description

Obtain contiguous storage for at least the specified addLength bytes in the specified blob at position blob->length(), and then grow blob->length() by addLength. If, upon entry, such storage does not exist in blob, first trim the final data buffer, if any, and insert a new buffer obtained from the specified factory. Return a pointer to the beginning of the storage obtained. The behavior of this function is undefined unless 0 < addLength, and factory->allocate(), if called, yields a block of memory of a size at least as large as addLength.

Return Value

pointer to the beginning of the contiguous storage obtained

Parameters

NameDescription
blobblob to grow
addLengthnumber of bytes by which to grow blob
factoryfactory used to allocate a new buffer when needed