LSMP Class Reference
[Shared memory buffering]

#include <lsmp.hh>

Inheritance diagram for LSMP:

LSMP_ACCESS LSMP_CON LSMP_PROD

List of all members.

Public Types

typedef int eventid_type

Public Member Functions

bool valid () const
bool found () const
void dump (int flg=0xff) const
void dump (std::ostream &Out, int flg=0xff) const
void rqsynch (bool on)
void bufmode (int mode)
void keep (bool flag=true)
void lock (bool flag=true)
const char * Error (void) const
int getBufferLength (void) const
int getBufferCount (void) const
 LSMP (void)
 LSMP (LSMP &copy)
 LSMP (const char *name)
 LSMP (const char *name, int nbuf, int size)
 ~LSMP (void)
std::string getStat (const std::string &par) const
bool testFlag (int x) const
int getLockCount (void) const
void clrLockCount (void)

Public Attributes

LSMP_error error
 The last error to occur while accessing the partition.

Protected Member Functions

char * buffer_addr (int ibuf) const
int buffer_length (int ibuf) const
bool gate (bool close) const
void Zeuss (const char *name)

Protected Attributes

struct LSMP_globalpointer
 Pointer to the partition control area.
struct LSMP_consbkconptr
 Pointer to the partitions consumer database.
struct LSMP_bufferbufptr
 Pointer to the partitions buffer database.


Detailed Description

LSMP provides basic access to the shared memory partition. The data elements of the LSMP class keep track of partition status, and point to the different control tables within the partition. These are protected from the end user, but are available to the derived classes. brief Shared Memory Base Class.
Author:
J. Zweizig
Version:
1.3; Last Modified October 28,1999

Constructor & Destructor Documentation

LSMP::LSMP ( void   ) 

The default constructor creates the LSMP data structure without attaching it to a shared memory partition. brief Default constructor.

LSMP::LSMP ( LSMP copy  ) 

The Copy Constructor copies an existing partition handle and links it into the process list. brief Copy constructor.

LSMP::LSMP ( const char *  name  ) 

Attach and access an existing named partition. brief Access existing partition.

Parameters:
name Name of existing partition.

LSMP::LSMP ( const char *  name,
int  nbuf,
int  size 
)

Create a new partition with a specified name, number of buffers and buffer size (in bytes). This constructor will attach an existing parition with the correct name if the number of buffers and the buffer size are greater than or equal to the specified values. brief Partition creation constructor.

Parameters:
name Name of parition to be created.
nbuf Number of buffers in the partition to be created.
size Size (in bytes) of each buffer in the partition.

LSMP::~LSMP ( void   ) 

Deaccess and detach a partition. The physical shared memory partition and the semaphores used for synchronization are deleted if the use count falls to zero and the keep flag is not set. brief The Partition destructor.


Member Function Documentation

bool LSMP::valid (  )  const [inline]

Test that a partition is enabled for use.

bool LSMP::found (  )  const [inline]

Test that a partition has been found.

void LSMP::dump ( int  flg = 0xff  )  const

Write a formatted dump of the current status of the partition to the standard output stream.

Parameters:
flg Flag indicating which portions of partition to dump brief Print the partition status to cout

void LSMP::dump ( std::ostream &  Out,
int  flg = 0xff 
) const

Write a formatted dump of the current status of the partition to the specified output stream. Individual sections of the dump may be selected with flg. as follows:
flagData to be printed
1Header (partition name)
2Control/status data
4Buffer information
8Consumer infomation
brief Print the partition status to an output stream.

Parameters:
Out output stream to which the status dump will be written.
flg Or of flag bits indicating portions of dump to be included.

void LSMP::rqsynch ( bool  on  ) 

Turn On/Off request synchronization.

void LSMP::bufmode ( int  mode  ) 

Set the buffer allocation to a specified mode.
mode=0A buffer is released (moved to free list) any time is not reserved and not in use.
mode=1A buffer is released after it has been seen by at least one consumer and is no longer reserved or in use.
mode=2A buffer is not released except if it is unreserved, not in use and needed to fill a producer request.

void LSMP::keep ( bool  flag = true  ) 

Set a flag to indicate whether the partition is to be deleted when it is detached. If flag is true, the partition will not be deleted when it is detached and the use count falls to zero. brief Keep (or destroy) the partition on release.

void LSMP::lock ( bool  flag = true  ) 

Locks the shared memory partition into memory. In order for lock to work, the process must be able to set the effective user ID to 0. brief Lock the shared memory partition into memory

const char* LSMP::Error ( void   )  const

Get a description of the last error.

int LSMP::getBufferLength ( void   )  const [inline]

Get the length of the buffers in the attached partition. brief buffer length.

int LSMP::getBufferCount ( void   )  const [inline]

Get the number of buffers in the attached partition. brief buffer count.

std::string LSMP::getStat ( const std::string &  par  )  const

Get a shared memory parameter value. Valid parameters are:

brief Get a parameter.
Parameters:
par parameter name.
Returns:
parameter value.

bool LSMP::testFlag ( int  x  )  const

Test a shared memory status flag brief Get a flag value.

Parameters:
x Flag number.
Returns:
Flag status.

int LSMP::getLockCount ( void   )  const [inline]

Get the lock count.

void LSMP::clrLockCount ( void   )  [inline]

Clear the lock count.

char* LSMP::buffer_addr ( int  ibuf  )  const [protected]

brief Get the address of a specified buffer.

int LSMP::buffer_length ( int  ibuf  )  const [protected]

Get the current data length of a specified buffer

bool LSMP::gate ( bool  close  )  const [protected]

Request or release exclusive write control over the partition control structure.

void LSMP::Zeuss ( const char *  name  )  [protected]

Zero the use count and clean the keep flag for the named (not attached) partition. The named partition will be like totally blown away after this.


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