#include <dc_buffer.h>
Inheritance diagram for DC_Buffer_t::
Public Methods | |
DC_Buffer_t (void) | |
DC_Buffer_t (int wMax) | |
DC_Buffer_t (char *pBuf, int wMax, int wSize) | |
DC_Buffer_t (const DC_Buffer_t &buf) | |
void | consume (void) |
Release a buffer. More... | |
bool | getConsume (void) |
Get the consume state. | |
void | setConsume (bool fConsume_in) |
Set the consume state. | |
Public Attributes | |
DC_Buffer_t* | pNext |
Optionally used by application (ex: list of buffers). |
A DC_Buffer_t is the unit of transfer for streams. This class is simply a container for a chunk of contiguous memory, which can be statically or dynamically allocated. These buffers have a maximum size, and keep track of how much of that maximum is occupied. Data that will fit into the unused portion of the buffer can be appended. Extraction occurs from the head of the buffer, maintaining a extraction pointer for multiple extraction operations. An application can also just get a pointer and length of the data in the buffer, and use it in place.
When finished with a buffer, the consume() method should be called, which may free the space. Heap allocated memory is handled correctly based on the constructor used. Generally avoiding static DC_Buffer_t objects with the use of consume() is advised, unless setConsume() with the value true is explicitly called.
|
Release a buffer. Called on a buffer returned from read that a filter will not need any longer. (Depending how memory was allocated for the buffer data area, this may or may not free the actual buffer space.) |