LSMP_CON Class Reference
[Shared memory buffering]

#include <lsmp_con.hh>

Inheritance diagram for LSMP_CON:

LSMP

List of all members.

Public Member Functions

 LSMP_CON (void)
 LSMP_CON (const char *part, int nbuf=0, int mask=-1)
 ~LSMP_CON (void)
const char * getBuffAddr (void) const
eventid_type getEvtID (void) const
int getLength (void) const
int getMask (void) const
int getNBuffer (void) const
int getNSkip (void) const
bool isConnected (void) const
bool latest_buffer (void) const
bool operator! (void) const
void setNBuffer (int nbuf)
void setNSkip (int nskip)
const char * get_buffer (int flags=0)
const char * find_dataID (eventid_type ID)
bool free_buffer ()


Detailed Description

The shared memory consumer class allows processes to read data buffers as they are made available by the partition manager. At initialization, each consumer specifies the maximum number of buffers to be reserved at one time for it to read. Consumers access data by using get_buffer and free_buffer. brief Shared Memory Consumer Class.
Author:
John G. Zweizig
Version:
1.3; Modified: October 28, 1999

Constructor & Destructor Documentation

LSMP_CON::LSMP_CON ( void   ) 

The default constructor creates the consumer data structure without Attaching it to a partition or allocating a consumer slot. brief Default (null consumer) constructor.

LSMP_CON::LSMP_CON ( const char *  part,
int  nbuf = 0,
int  mask = -1 
)

The consumer access constructor finds the specified parititon and allocates a consumer slot in the partition. If no partition exists with the given name, a new partition will be created with default size parameters .he nbuf and mask arguments specify respectively the number of buffers to be reserved automatically for the consumer and the requisite type-flags for data to be read by the consumer. brief Consumer access constructor.

Parameters:
part Pointer to character string with the partition name.
nbuf Number of buffers to reserve for the new consumer.
mask Bit mask indicating event types to be accepted by the consumer.

LSMP_CON::~LSMP_CON ( void   ) 

The consumer destructor releases the consumer slot if one was allocated. It also releases the partition if no other processes are using the parititon and the Keep flag is not set. brief Consumer destructor.


Member Function Documentation

const char * LSMP_CON::getBuffAddr ( void   )  const [inline]

Get the current buffer address. brief Buffer address.

Returns:
Address of the currently allocated buffer.

eventid_type LSMP_CON::getEvtID ( void   )  const

Get the record ID of the consumer data. brief Get current record ID.

Returns:
Identifier of the current data record.

int LSMP_CON::getLength ( void   )  const [inline]

Get the length in bytes of the data in the current consumer buffer. brief Get current record length.

Returns:
Number of bytes of data in current buffer.

int LSMP_CON::getMask ( void   )  const

Get the event type mask. brief Get event mask.

int LSMP_CON::getNBuffer ( void   )  const

Get the current buffer address. brief Buffer address.

int LSMP_CON::getNSkip ( void   )  const

Get the number of buffers to skip between buffers allocated. brief Skip count.

Returns:
Number of buffers to be skipped.

bool LSMP_CON::isConnected ( void   )  const [inline]

Test whether the consumer is connected to the partition i.e. whether a consumer id has been allocated. brief Test for connected consumer

Returns:
true if consumer is connected to the partition.

bool LSMP_CON::latest_buffer ( void   )  const

Test whether the consumer's buffer is the latest in the free queue brief Test for latest buffer

Returns:
true if buffer is lates in free queue

bool LSMP_CON::operator! ( void   )  const [inline]

Test for errors in construction or connection of consumer. brief Test for invalid consumer

Returns:
true if consumer is not connected to the partition.

void LSMP_CON::setNBuffer ( int  nbuf  ) 

Sets the maximum number of full buffers that will be reserved for the consumer. This overrides the nbuf argument of the constructor. If "nbuf<0" all buffers will be reserved. If "nbuf=0" no buffers will be reserved and data will received as it becomes available. Reserved buffers will not be released until they have been read, even if nbuf is set to a value less than the current number of reserved buffers. brief Specify the number of buffers to reserve.

Parameters:
nbuf The number of buffers to reserve or -1 for all buffers.

void LSMP_CON::setNSkip ( int  nskip  ) 

Set the number of buffers to skip between reading buffers. The consumer skips the specified number of otherwise qualifying buffers between reading buffers. By default, the skip count is set to zero so all buffers matching the trigger criteria will be read. brief Set skip count.

Parameters:
nskip Number of buffers to be skipped.

const char* LSMP_CON::get_buffer ( int  flags = 0  ) 

Get a buffer of data and associate it with the consumer. The buffer address is returned. If the consumer already has a buffer, no new buffer is allocated and the old buffer address is returned. By default, the consumer will wait for new data if no unread buffers are available. If "(flags & NOWAIT) != 0", get_buffer will return immediately with a NULL buffer address if no buffers are available. brief Allocate a full buffer.

Returns:
Pointer to the start of the allocated data buffer.
Parameters:
flags Function modifier flag word.

const char* LSMP_CON::find_dataID ( eventid_type  ID  ) 

find_dataID() finds a specific data record identified by the data ID and returns the address of the buffer it is in. If the requested record isn't currently in the partition, find_dataID() returns NULL. brief Find a specific data buffer.

Returns:
pointer to the buffer containing the requested data.
Parameters:
ID identified of data record to be found

bool LSMP_CON::free_buffer (  ) 

free_buffer() instructs the partition manager to release the data buffer accessed by the consumer. brief Release a buffer.


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