BloombergLP::bdlma::BufferImpUtil

This struct provides a namespace for a suite of pure procedures for allocating memory from a buffer.

Synopsis

Declared in <bdlma_bufferimputil.h>

struct BufferImpUtil;

Static Member Functions

NameDescription
allocateFromBuffer Allocate a memory block of the specified size (in bytes) from the specified buffer having the specified bufferSize (in bytes) at the specified cursor position, using the specified alignment strategy. Return the address of the allocated memory block if buffer contains sufficient available memory, and 0 otherwise. The cursor is set to the first byte position immediately after the allocated memory if there is sufficient memory, and not modified otherwise. The behavior is undefined unless 0 < size, 0 <= *cursor, and *cursor <= bufferSize.
allocateFromBufferRaw Allocate a memory block of the specified size (in bytes) from the specified buffer at the specified cursor position, using the specified alignment strategy. Return the address of the allocated memory block. The cursor is set to the first byte position immediately after the allocated memory. The behavior is undefined unless 0 < size, buffer contains sufficient available memory, and cursor refers to a valid position in buffer.
allocateMaximallyAlignedFromBuffer Allocate a maximally-aligned memory block of the specified size (in bytes) from the specified buffer having the specified bufferSize (in bytes) at the specified cursor position. Return the address of the allocated memory block if buffer contains sufficient available memory, and 0 otherwise. The cursor is set to the first byte position immediately after the allocated memory if there is sufficient memory, and not modified otherwise. The behavior is undefined unless 0 < size, 0 <= *cursor, and *cursor <= bufferSize.
allocateMaximallyAlignedFromBufferRaw Allocate a maximally-aligned memory block of the specified size (in bytes) from the specified buffer at the specified cursor position. Return the address of the allocated memory block. The cursor is set to the first byte position immediately after the allocated memory. The behavior is undefined unless 0 < size, buffer contains sufficient available memory, and cursor refers to a valid position in buffer.
allocateNaturallyAlignedFromBuffer Allocate a naturally-aligned memory block of the specified size (in bytes) from the specified buffer having the specified bufferSize (in bytes) at the specified cursor position. Return the address of the allocated memory block if buffer contains sufficient available memory, and 0 otherwise. The cursor is set to the first byte position immediately after the allocated memory if there is sufficient memory, and not modified otherwise. The behavior is undefined unless 0 < size, 0 <= *cursor, and *cursor <= bufferSize.
allocateNaturallyAlignedFromBufferRaw Allocate a naturally-aligned memory block of the specified size (in bytes) from the specified buffer at the specified cursor position. Return the address of the allocated memory block. The cursor is set to the first byte position immediately after the allocated memory. The behavior is undefined unless 0 < size, buffer contains sufficient available memory, and cursor refers to a valid position in buffer.
allocateOneByteAlignedFromBuffer Allocate a 1-byte-aligned memory block of the specified size (in bytes) from the specified buffer having the specified bufferSize (in bytes) at the specified cursor position. Return the address of the allocated memory block if buffer contains sufficient available memory, and 0 otherwise. The cursor is set to the first byte position immediately after the allocated memory if there is sufficient memory, and not modified otherwise. The behavior is undefined unless 0 < size, 0 <= *cursor, and *cursor <= bufferSize.
allocateOneByteAlignedFromBufferRaw Allocate a 1-byte-aligned memory block of the specified size (in bytes) from the specified buffer at the specified cursor position. Return the address of the allocated memory block. The cursor is set to the first byte position immediately after the allocated memory. The behavior is undefined unless 0 < size, buffer contains sufficient available memory, and cursor refers to a valid position in buffer.