[#BloombergLP-bdlma-BufferImpUtil]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlma.adoc[bdlma]::BufferImpUtil
:relfileprefix: ../../
:mrdocs:

This `struct` provides a namespace for a suite of pure procedures for allocating memory from a buffer&period;

== Synopsis

Declared in `&lt;bdlma&lowbar;bufferimputil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
struct BufferImpUtil;
----

== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlma/BufferImpUtil/allocateFromBuffer.adoc[`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`&period; Return the address of the allocated memory block if `buffer` contains sufficient available memory, and 0 otherwise&period; The `cursor` is set to the first byte position immediately after the allocated memory if there is sufficient memory, and not modified otherwise&period; The behavior is undefined unless `0 &lt; size`, `0 &lt;&equals; &ast;cursor`, and `&ast;cursor &lt;&equals; bufferSize`&period;
| xref:BloombergLP/bdlma/BufferImpUtil/allocateFromBufferRaw.adoc[`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`&period; Return the address of the allocated memory block&period; The `cursor` is set to the first byte position immediately after the allocated memory&period; The behavior is undefined unless `0 &lt; size`, `buffer` contains sufficient available memory, and `cursor` refers to a valid position in `buffer`&period;
| xref:BloombergLP/bdlma/BufferImpUtil/allocateMaximallyAlignedFromBuffer.adoc[`allocateMaximallyAlignedFromBuffer`] 
| Allocate a maximally&hyphen;aligned memory block of the specified `size` (in bytes) from the specified `buffer` having the specified `bufferSize` (in bytes) at the specified `cursor` position&period; Return the address of the allocated memory block if `buffer` contains sufficient available memory, and 0 otherwise&period; The `cursor` is set to the first byte position immediately after the allocated memory if there is sufficient memory, and not modified otherwise&period; The behavior is undefined unless `0 &lt; size`, `0 &lt;&equals; &ast;cursor`, and `&ast;cursor &lt;&equals; bufferSize`&period;
| xref:BloombergLP/bdlma/BufferImpUtil/allocateMaximallyAlignedFromBufferRaw.adoc[`allocateMaximallyAlignedFromBufferRaw`] 
| Allocate a maximally&hyphen;aligned memory block of the specified `size` (in bytes) from the specified `buffer` at the specified `cursor` position&period; Return the address of the allocated memory block&period; The `cursor` is set to the first byte position immediately after the allocated memory&period; The behavior is undefined unless `0 &lt; size`, `buffer` contains sufficient available memory, and `cursor` refers to a valid position in `buffer`&period;
| xref:BloombergLP/bdlma/BufferImpUtil/allocateNaturallyAlignedFromBuffer.adoc[`allocateNaturallyAlignedFromBuffer`] 
| Allocate a naturally&hyphen;aligned memory block of the specified `size` (in bytes) from the specified `buffer` having the specified `bufferSize` (in bytes) at the specified `cursor` position&period; Return the address of the allocated memory block if `buffer` contains sufficient available memory, and 0 otherwise&period; The `cursor` is set to the first byte position immediately after the allocated memory if there is sufficient memory, and not modified otherwise&period; The behavior is undefined unless `0 &lt; size`, `0 &lt;&equals; &ast;cursor`, and `&ast;cursor &lt;&equals; bufferSize`&period;
| xref:BloombergLP/bdlma/BufferImpUtil/allocateNaturallyAlignedFromBufferRaw.adoc[`allocateNaturallyAlignedFromBufferRaw`] 
| Allocate a naturally&hyphen;aligned memory block of the specified `size` (in bytes) from the specified `buffer` at the specified `cursor` position&period; Return the address of the allocated memory block&period; The `cursor` is set to the first byte position immediately after the allocated memory&period; The behavior is undefined unless `0 &lt; size`, `buffer` contains sufficient available memory, and `cursor` refers to a valid position in `buffer`&period;
| xref:BloombergLP/bdlma/BufferImpUtil/allocateOneByteAlignedFromBuffer.adoc[`allocateOneByteAlignedFromBuffer`] 
| Allocate a 1&hyphen;byte&hyphen;aligned memory block of the specified `size` (in bytes) from the specified `buffer` having the specified `bufferSize` (in bytes) at the specified `cursor` position&period; Return the address of the allocated memory block if `buffer` contains sufficient available memory, and 0 otherwise&period; The `cursor` is set to the first byte position immediately after the allocated memory if there is sufficient memory, and not modified otherwise&period; The behavior is undefined unless `0 &lt; size`, `0 &lt;&equals; &ast;cursor`, and `&ast;cursor &lt;&equals; bufferSize`&period;
| xref:BloombergLP/bdlma/BufferImpUtil/allocateOneByteAlignedFromBufferRaw.adoc[`allocateOneByteAlignedFromBufferRaw`] 
| Allocate a 1&hyphen;byte&hyphen;aligned memory block of the specified `size` (in bytes) from the specified `buffer` at the specified `cursor` position&period; Return the address of the allocated memory block&period; The `cursor` is set to the first byte position immediately after the allocated memory&period; The behavior is undefined unless `0 &lt; size`, `buffer` contains sufficient available memory, and `cursor` refers to a valid position in `buffer`&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
