Manipulates data buffers of variable length.
For fixed length data buffers, or buffers whose length does not vary much from a known maximum size, use descriptors rather than this API.
The API has three key concepts: dynamic buffer base, flat dynamic buffer, and segmented dynamic buffer.
The dynamic buffer base specifies a common interface to dynamic buffers. It provides operations to manage the buffer position, a byte offset into the buffers data. Clients use a buffer position to reference the buffer, rather than explicit pointers, which can become outdated when reallocations occur.
The dynamic buffer base interface is provided by the abstract
class CBufBase
.
The flat dynamic buffer stores all data in a single contiguous memory area. A flat buffer is the most efficient choice when resizing the buffer beyond a certain maximum length is not expected often.
The flat dynamic buffer interface is provided by
CBufFlat
.
The segmented dynamic buffer can store data in multiple memory areas. They are to be preferred for very large amounts of data, and where resizing of the buffer is commonly expected.
The segmented dynamic buffer interface is provided by
CBufSeg
.