lmsg::Buffer Class Reference
[DMT message facility]

Socket I/O buffer. More...

#include <Buffer.hh>

List of all members.

Public Member Functions

 Buffer (size_type size, char *data=0)
 Constructor.
 ~Buffer (void)
 Destructor.
const char * getBuffer (void) const
 Get buffer pointer.
const char * getDataAddr (void) const
 Get data pointer.
const MsgHeadergetHeader (void) const
 Get a header reference.
size_type getLength (void) const
 Get message length.
size_type getSize (void) const
 Buffer length.
size_type getDataSize (void) const
 Get maximum data length.
size_type getDataLength (void) const
 Current data length.
char * getBuffer (void)
 Get buffer pointer.
char * getDataAddr (void)
 Get data pointer.
MsgHeadergetHeader (void)
 Get a header reference.
void Return (void)
 Return the buffer to pool.
void setLength (size_type length)
 Set total message length.
void setDataLength (size_type length)
 Set the data length.
void setPool (BufferPool &pool)
 Set the buffer pool address.


Detailed Description

Socket I/O buffer.

Preallocated uffer used in csocket I/O.

Author:
J. Zweizig
Version:
1.0; Last modified February 26, 2008

Constructor & Destructor Documentation

lmsg::Buffer::Buffer ( size_type  size,
char *  data = 0 
)

Constructor.

Construct an empty buffer of a specified size. If the data address is null the buffer is marked as local and a data segment of the specified length is allocated. The allocated buffer is released when the buffer is deleted.

Parameters:
size Length of buffer
data Pointer to buffer to be used.

lmsg::Buffer::~Buffer ( void   ) 

Destructor.

Destroy a buffer and free the data storage if it is local.


Member Function Documentation

const char * lmsg::Buffer::getBuffer ( void   )  const [inline]

Get buffer pointer.

Get a constant pointer to the start of the buffer.

Returns:
Constant pointer to the buffer.

const char * lmsg::Buffer::getDataAddr ( void   )  const [inline]

Get data pointer.

Get a constant pointer to the start of the message data.

Returns:
Constant pointer to the message data.

const lmsg::MsgHeader & lmsg::Buffer::getHeader ( void   )  const [inline]

Get a header reference.

Get a constant reference to the header of the message stored in the buffer.

Returns:
Constant reference to the message header.

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

Get message length.

Get total message (data + header) length.

Returns:
Total message length.

lmsg::size_type lmsg::Buffer::getSize ( void   )  const [inline]

Buffer length.

Get the buffer length.

Returns:
The buffer length

lmsg::size_type lmsg::Buffer::getDataSize ( void   )  const [inline]

Get maximum data length.

Get maximum allowable length of the message data.

Returns:
Maximum allowable data length.

lmsg::size_type lmsg::Buffer::getDataLength ( void   )  const [inline]

Current data length.

Get the current length of the data portion of the message.

Returns:
Current length of data portion of message.

char * lmsg::Buffer::getBuffer ( void   )  [inline]

Get buffer pointer.

Get a writable pointer to the start of the buffer.

Returns:
Pointer to the buffer.

char * lmsg::Buffer::getDataAddr ( void   )  [inline]

Get data pointer.

Get a writable pointer to the start of the message data.

Returns:
Pointer to the message data.

lmsg::MsgHeader & lmsg::Buffer::getHeader ( void   )  [inline]

Get a header reference.

Get a reference to the header of the message stored in the buffer.

Returns:
Reference to the message header.

void lmsg::Buffer::Return ( void   ) 

Return the buffer to pool.

Return the buffer to its pool.

void lmsg::Buffer::setLength ( size_type  length  ) 

Set total message length.

Set the total message length.

Parameters:
length Message length.

void lmsg::Buffer::setDataLength ( size_type  length  ) 

Set the data length.

Set the message data length. Note that the header length is added to the data length to give the total message length.

Parameters:
length Message data length.

void lmsg::Buffer::setPool ( BufferPool pool  ) 

Set the buffer pool address.

Specify the pool to which the buffer will be returned.

Parameters:
pool reference to pool the buffer is to be returned to.


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