lmsg::BufferPool Class Reference
[DMT message facility]

Buffer Pool class. More...

#include <BufferPool.hh>

List of all members.

Public Member Functions

 ~BufferPool (void)
 Destructor.
 BufferPool (size_type number, size_type length)
 Construct a buffer pool.
BuffergetBuffer (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.


Detailed Description

Buffer Pool class.

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.

Author:
John Zweizig
Version:
1.2; Last modified March 4, 2008

Constructor & Destructor Documentation

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.

Parameters:
number Number of buffer to allocate.
length Length of buffer to allocate.


Member Function Documentation

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.

Parameters:
buff Pointer to the buffer to be returned to the pool.

size_type lmsg::BufferPool::getLength ( void   )  const [inline]

Get the bufffer length.

Get the length of a buffer in bytes.

Returns:
Buffer length in bytes.

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.

Returns:
Longest message data portion in bytes.


The documentation for this class was generated from the following file:
Generated on Sun Mar 8 19:21:32 2009 for dmt by  doxygen 1.5.4