iSMbuf Class Reference
[Shared memory buffering]

#include <iSMbuf.hh>

List of all members.

Public Types

typedef std::ios::openmode openmode_type
typedef std::ios::seekdir seekdir_type
typedef std::streamoff off_type
typedef std::streampos pos_type

Public Member Functions

 iSMbuf ()
 iSMbuf (const char *partition, openmode_type mode=std::ios::in)
 ~iSMbuf ()
int eventid (void) const
bool latest (void) const
iSMbufopen (const char *partition, openmode_type mode=std::ios::in)
void setBCount (int nbuf)
bool waitBuf (bool nowait=false)
void relse (void)
int doallocate (void)
int overflow (int c)
int underflow (void)
pos_type seekoff (off_type off, seekdir_type dir, openmode_type mode)
pos_type seekpos (pos_type off, openmode_type mode)
int sync ()


Detailed Description

This class interfaces the shared memory buffer manager to a standard data stream. iSMbuf is based on the standard stream buffer (streambuf) class and implements the virtual buffering methods of that class. In addition to the standard methods, the iSMbuf class contains waitBuf and setBCount methods to wait for asynchronous data and to set a reserved buffer count, respectively. The buffer functions ignore the arrival of signals, except in the waitBuf method. brief Shared memory stream input buffer class.
Author:
John Zweizig
Version:
1.1; last modified March 6, 2008

Member Typedef Documentation

typedef std::streamoff iSMbuf::off_type

Get the offset type from the STL streambuf.

typedef std::streampos iSMbuf::pos_type

Get the position type from the STL streambuf.


Constructor & Destructor Documentation

iSMbuf::iSMbuf (  ) 

Default constructor. The default constructor builds an unopened shared memory stream buffer.

iSMbuf::iSMbuf ( const char *  partition,
openmode_type  mode = std::ios::in 
)

Construct an opened shared memory stream buffer. A shared memory stream buffer is created and attached (if possible) to the specified shared memory partition. The partition to be attached is specified by 'partition'. The mode flag is kept for compatibility with the file stream and must be set to ios::in.

iSMbuf::~iSMbuf (  ) 

Shared memory stream buffer destructor.


Member Function Documentation

int iSMbuf::eventid ( void   )  const

Get the current buffer event id.

bool iSMbuf::latest ( void   )  const

Test for latest buffer in partition.

iSMbuf* iSMbuf::open ( const char *  partition,
openmode_type  mode = std::ios::in 
)

Attach a shared memory partition to a stream buffer. The named partition is attached to the stream buffer.

void iSMbuf::setBCount ( int  nbuf  ) 

This parameter controls what fraction of the data read into the shared memory will be copied to the data stream and what part of the shared memory resources can be held allocated the stream. 'nbuf' == 0 indicates data is taken as requested. 'nbuf' == -1 indicates that all data written to the shared memory must be copied to the data stream. 'nbuf'==N indicates that up to N buffers (frames) of data should be held until the stream is ready for them. brief Set the number of segments to be reserved by this consumer.

bool iSMbuf::waitBuf ( bool  nowait = false  ) 

Test whether data are available. If data are available, waitBuf returns true. If data are not immediately available and the nowait argument is true, waitData returns false. Otherwise waitBuf waits for data to arrive or the semaphore wait to be interrupted by a signal. brief Wait for data.

Parameters:
nowait If true, waitBuf returns immediately.
Returns:
true if data available.

void iSMbuf::relse ( void   ) 

Release a shared memory buffer. brief Release shared memory buffer.

int iSMbuf::doallocate ( void   ) 

Standard streambuf allocation function.

int iSMbuf::overflow ( int  c  )  [inline]

Standard streambuf overflow function.

int iSMbuf::underflow ( void   ) 

Standard streambuf read function.

pos_type iSMbuf::seekoff ( off_type  off,
seekdir_type  dir,
openmode_type  mode 
)

Standard streambuf seek offset function.

iSMbuf::pos_type iSMbuf::seekpos ( pos_type  off,
openmode_type  mode 
) [inline]

Standard streambuf seek position function.

int iSMbuf::sync ( void   )  [inline]

Standard streambuf synchronization function.


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