Quick Links: |
#include <bdlma_bufferimputil.h>
This struct
provides a namespace for a suite of pure procedures for allocating memory from a buffer.
See Component bdlma_bufferimputil
static void* bdlma::BufferImpUtil::allocateFromBuffer | ( | bsls::Types::IntPtr * | cursor, | |
char * | buffer, | |||
bsls::Types::size_type | bufferSize, | |||
bsls::Types::size_type | size, | |||
bsls::Alignment::Strategy | strategy | |||
) | [static] |
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
.
static void* bdlma::BufferImpUtil::allocateMaximallyAlignedFromBuffer | ( | bsls::Types::IntPtr * | cursor, | |
char * | buffer, | |||
bsls::Types::size_type | bufferSize, | |||
bsls::Types::size_type | size | |||
) | [static] |
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
.
static void* bdlma::BufferImpUtil::allocateNaturallyAlignedFromBuffer | ( | bsls::Types::IntPtr * | cursor, | |
char * | buffer, | |||
bsls::Types::size_type | bufferSize, | |||
bsls::Types::size_type | size | |||
) | [static] |
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
.
static void* bdlma::BufferImpUtil::allocateOneByteAlignedFromBuffer | ( | bsls::Types::IntPtr * | cursor, | |
char * | buffer, | |||
bsls::Types::size_type | bufferSize, | |||
bsls::Types::size_type | size | |||
) | [static] |
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
.
static void* bdlma::BufferImpUtil::allocateFromBufferRaw | ( | bsls::Types::IntPtr * | cursor, | |
char * | buffer, | |||
bsls::Types::size_type | size, | |||
bsls::Alignment::Strategy | strategy | |||
) | [static] |
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
.
static void* bdlma::BufferImpUtil::allocateMaximallyAlignedFromBufferRaw | ( | bsls::Types::IntPtr * | cursor, | |
char * | buffer, | |||
bsls::Types::size_type | size | |||
) | [static] |
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
.
static void* bdlma::BufferImpUtil::allocateNaturallyAlignedFromBufferRaw | ( | bsls::Types::IntPtr * | cursor, | |
char * | buffer, | |||
bsls::Types::size_type | size | |||
) | [static] |
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
.
static void* bdlma::BufferImpUtil::allocateOneByteAlignedFromBufferRaw | ( | bsls::Types::IntPtr * | cursor, | |
char * | buffer, | |||
bsls::Types::size_type | size | |||
) | [static] |
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
.