#include <types.hpp>
Public Member Functions | |
Creators | |
DataBuf () | |
Default constructor. | |
DataBuf (long size) | |
Constructor with an initial buffer size. | |
DataBuf (const byte *pData, long size) | |
Constructor, copies an existing buffer. | |
DataBuf (DataBuf &rhs) | |
Copy constructor. Transfers the buffer to the newly created object similar to std::auto_ptr, i.e., the original object is modified. | |
~DataBuf () | |
Destructor, deletes the allocated buffer. | |
Manipulators | |
DataBuf & | operator= (DataBuf &rhs) |
Assignment operator. Transfers the buffer and releases the buffer at the original object similar to std::auto_ptr, i.e., the original object is modified. | |
void | alloc (long size) |
Allocate a data buffer of at least the given size. Note that if the requested size is less than the current buffer size, no new memory is allocated and the buffer size doesn't change. | |
std::pair< byte *, long > | release () |
Release ownership of the buffer to the caller. Returns the buffer as a data pointer and size pair, resets the internal buffer. | |
void | reset (std::pair< byte *, long >=std::make_pair((byte *)(0), long(0))) |
Reset value. | |
Conversions | |
Special conversions with auxiliary type to enable copies and assignments, similar to those used for std::auto_ptr. See http://www.josuttis.com/libbook/auto_ptr.html for a discussion. | |
DataBuf (DataBufRef rhs) | |
DataBuf & | operator= (DataBufRef rhs) |
operator DataBufRef () | |
Public Attributes | |
byte * | pData_ |
Pointer to the buffer, 0 if none has been allocated. | |
long | size_ |
The current size of the buffer. |