#include <BufferPool.hh>
Public Member Functions | |
| ~BufferPool (void) | |
| Destructor. | |
| BufferPool (size_type number, size_type length) | |
| Construct a buffer pool. | |
| Buffer * | getBuffer (void) |
| Get a buffer. | |
| void | returnBuffer (Buffer *buff) |
| Return a buffer. | |
| size_type | getLength (void) const |
| Get the bufffer length. | |
| size_type | getDataLength (void) const |
| Get maximum data length. | |
The BufferPool class defines a pool of pre-allocated fixed-length buffers to be used for asynchronous I/O in the Ligo DMT Message (lmsg) facility.
| lmsg::BufferPool::~BufferPool | ( | void | ) |
Destructor.
Destroy a buffer pool and free all its buffers. If the number of buffers freed is not equal to the number allocated, an error message is printed to cerr.
| lmsg::BufferPool::BufferPool | ( | size_type | number, | |
| size_type | length | |||
| ) |
Construct a buffer pool.
Construct a buffer pool containing the specified number of buffers of the specified length.
| number | Number of buffer to allocate. | |
| length | Length of buffer to allocate. |
| Buffer* lmsg::BufferPool::getBuffer | ( | void | ) |
Get a buffer.
Get a buffer from the pool. If the pool is empty, a null pointer is returned.
| void lmsg::BufferPool::returnBuffer | ( | Buffer * | buff | ) |
Return a buffer.
Return the specified buffer to the pool.
| buff | Pointer to the buffer to be returned to the pool. |
| size_type lmsg::BufferPool::getLength | ( | void | ) | const [inline] |
| size_type lmsg::BufferPool::getDataLength | ( | void | ) | const |
Get maximum data length.
Get the length of the data portion of the longest message that can fit in the buffer.
1.5.4