LSMP_PROD Class Reference
[Shared memory buffering]

#include <lsmp_prod.hh>

Inheritance diagram for LSMP_PROD:

LSMP

List of all members.

Public Member Functions

 LSMP_PROD (void)
 LSMP_PROD (const char *part)
 LSMP_PROD (const char *part, int nbuf, int lbuf)
 ~LSMP_PROD (void)
bool operator! (void) const
char * get_buffer (int flags=0)
void release (int length, int mask=-1, int flags=0)
void return_buffer (void)
void SetID (int ID)


Detailed Description

LSMP_PROD provides an interface to the shared memory partition for data producer processes. The shared memory partition is optionally created and attached to by the LSMP_PROD constructors. Buffers are allocated for write acces with get_buffer() and released for reading by the consumers with release(). brief Shared Memory Producer Class.
Author:
John G. Zweizig
Version:
1.3; Modified October 7, 1999

Constructor & Destructor Documentation

LSMP_PROD::LSMP_PROD ( void   ) 

Constructs a null producer, not connected to any partition. brief Default constructor.

LSMP_PROD::LSMP_PROD ( const char *  part  ) 

Initialize a producer structure and attach it to an existing partition. If the named partition doesn't exist, it is created with default parameters. brief Attach to a partition.

Parameters:
part Name of partition to be attached.

LSMP_PROD::LSMP_PROD ( const char *  part,
int  nbuf,
int  lbuf 
)

A partition is created and is accessed by the producer. If a partiton with the desired buffer count and length already exists it is accessed. If an incompatible partition exists, it is not accessed. brief Create a partition and attach a producer.

Parameters:
part Name of partition to be created/attached.
nbuf Minimum number of buffer in partition.
lbuf Minimum buffer length in bytes of partition.

LSMP_PROD::~LSMP_PROD ( void   ) 

If a buffer has been allocated, it is released. If a partition is attached, it is released (see LSMP::release). brief Producer destructor.


Member Function Documentation

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

This operator returns true if the producer is not ready to supply data to the specified partition. brief Test for error condition.

Returns:
true if an error condition exists in the producer.

char* LSMP_PROD::get_buffer ( int  flags = 0  ) 

A buffer is allocate according to the current buffer mode and its address is returned. The buffer will normally be allocated from the free list. If there are no free buffers available and if the buffer allocation mode is set to a scavaging mode (see LSMP::bufmode) the oldest unused full buffer is allocated. If no (free or full) buffers can be found, get_buffer will block until a buffer is available unless (flags & NOWAIT) != 0. brief Allocate an empty buffer.

Returns:
Pointer to allocated buffer or NULL if no buffers available.
Parameters:
flags function modifier flag.

void LSMP_PROD::release ( int  length,
int  mask = -1,
int  flags = 0 
)

The current buffer is released and marked as reserved by any consumers waiting for a buffer. The trigger bit mask indicates the type of data contained in the buffer. The data buffer will be sent only to those consumers with a trigger mask containing one or more common bits with the buffer mask. If flags is set to SHOWALL, the specified buffer will be reserved by all current consumers, independent of the number of buffers currently reserved by the consumer and the reservation limit. The SHOWALL mechanism may be used to transmit control information suc as end-of-file status. brief Release a full buffer.

Parameters:
length The length of the buffer data in bytes.
mask A trigger identifier mask.
flags Special handling flags as described above.

void LSMP_PROD::return_buffer ( void   ) 

The current buffer is returned to the free list without being distributed to any consumers. brief Return an unused buffer.

void LSMP_PROD::SetID ( int  ID  ) 

SetID sets a record ID for the buffer currently owned by the consumer. The record ID may be used by the consumer to access a specific record. brief Set the record ID for the current buffer.

Parameters:
ID Record identifier for the current buffer.


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