Main Page | Class Hierarchy | Class List | File List | Class Members

RIPCSharedMemory Class Reference

#include <RIPCSharedMemory.h>

Inheritance diagram for RIPCSharedMemory:

RIPCPrimitive List of all members.

Public Types

enum  RIPCPrimitiveType {
  RIPC_MUTEX, RIPC_EVENT, RIPC_SEMAPHORE, RIPC_BARRIER,
  RIPC_LOCK, RIPC_SHARED_MEMORY, RIPC_QUEUE
}
enum  RIPCRanks { DEFAULT_RANK = 0 }

Public Member Functions

virtual void set (RIPCObject const &objDesc)=0
virtual void set (void const *obj, size_t objSize)=0
virtual void get (RIPCObject &objDesc)=0
void * get ()
RIPCPrimitiveType getType ()
char const * getTypeName ()
virtual char const * getName ()=0
virtual bool alreadyExists ()=0
void waitFor ()
bool waitFor (unsigned timeout)
virtual void priorityWait (int rank)=0
virtual bool priorityWait (int rank, unsigned timeout)=0
virtual void reset ()=0
virtual void close ()=0
virtual void * allocate (size_t size)
virtual void deallocate (void *obj, size_t size=0)

Static Public Member Functions

void deallocator (RIPCObject const &objDesc)

Detailed Description

Shared memory object. This class is used to organize replication of data between all listeners of this object. Listener should use wait method to detect moment when object is updated by set method by some other session. Then it should call get method to get the most recent version of the object. If client prefer to receive updates asynchronously, it should lanunch separate thread which will preform wait in loop for updates of this object, thne get the most recent version of the object and somehow notify other threads that object is changed.

Semantic of methods inherited from RIPCPrimitive:

waitFor
Wait until version of the object at client becomes deteriorated. For local sessions, this metod always wait until set method is invoked. For remote sessions, sequence number of the object is remembered by local stub and is sent to the server to be compared with sequence number of shared memory object at the server.
reset
Do nothing


Member Enumeration Documentation

enum RIPCPrimitive::RIPCPrimitiveType [inherited]
 

Primitive types


Member Function Documentation

virtual void* RIPCPrimitive::allocate size_t  size  )  [virtual, inherited]
 

Method for allocation memory for container elements (currently queue and shared memory). This method can be overriden by derived class* to provide custom allocation policy.

virtual bool RIPCPrimitive::alreadyExists  )  [pure virtual, inherited]
 

Primitive returned by createXXX method already exists This method should be call immediatly after createXXX to check if new primitive was created or existed one was returned.

Returns:
true if createXXX method doesn't create new primitive

virtual void RIPCPrimitive::close  )  [pure virtual, inherited]
 

Close primitive. This method decrease access counter of the primitive and once it becomes zero, primitive is destroyed.

virtual void RIPCPrimitive::deallocate void *  obj,
size_t  size = 0
[virtual, inherited]
 

Method for deallocation memory for container elements (currently queue and shared memory). This method can be overriden by derived class to provide custom allocation policy.

void* RIPCSharedMemory::get  )  [inline]
 

Get the most recent version of shared memory object. Object is created by means of allocate() method and is byte-to-byte copy of element placed in the queue (no conversions are done). It is responsibility of programmer to deallocate it.

Returns:
copy of shared memory object

virtual void RIPCSharedMemory::get RIPCObject &  objDesc  )  [pure virtual]
 

Get the most recent version of shared memory object. If data field of object descrtiptor is not null, then it is assumed that buffer was specified by programmer. In this case size field of object descriptor specifies size of the buffer. If it is smaller than size of the fetched object, then RIPCInvalidParameterException will bee thrown. Size of the fetched object is than assigned to size field of the object descriptor.
If data field was not specified (is null), then buffer is allocated by means of allocate() methodk. It is responsibility of programmer to deallocate it (using deallocate method).

Parameters:
objDesc descriptor of retrieved object

virtual char const* RIPCPrimitive::getName  )  [pure virtual, inherited]
 

Get primitive name. Name of the primitive is unique with primitives of the same type (events, semaphores,...). It is possible that, for example, event and mutex has the same name.

Returns:
primitive name

RIPCPrimitiveType RIPCSharedMemory::getType  )  [inline, virtual]
 

Get RIPC primitive type

Returns:
one of the constants from RIPCPrimitiveType enum

Implements RIPCPrimitive.

char const* RIPCPrimitive::getTypeName  )  [inherited]
 

Get RIPC primitive type name

Returns:
name of primitive type

virtual bool RIPCPrimitive::priorityWait int  rank,
unsigned  timeout
[pure virtual, inherited]
 

Priority wait until state of primitive is switched with timeout. Requests with the lowest rank value will be satisfied first. Semantic of this method depends on particular primitive type and is explained in specification of each primitive.

Parameters:
rank processes will be placed in wait queue in the order of increasing rank value and in the same order will be taken from the queue.
timeout operation timeout in millisoconds
Returns:
false if timeout is expired before primitive state is changed

virtual void RIPCPrimitive::priorityWait int  rank  )  [pure virtual, inherited]
 

Priority wait until state of primitive is switched. Requests with the lowest rank value will be satisfied first. Semantic of this method depends on particular primitive type and is explained in specification of each primitive.

Parameters:
rank processes will be placed in wait queue in the order of increasing rank value and in the same order will be taken from the queue.

virtual void RIPCPrimitive::reset  )  [pure virtual, inherited]
 

Reset primitive. Semantic of this method depends on particular primitive type and is explained in specification of each primitive.

virtual void RIPCSharedMemory::set void const *  obj,
size_t  objSize
[pure virtual]
 

Make new object visible to all other sessions using this shared memory object

Parameters:
obj non NULL poiner to the object to be replicated
objSize positive object size

virtual void RIPCSharedMemory::set RIPCObject const &  objDesc  )  [pure virtual]
 

Make new object visible to all other sessions using this shared memory object

Parameters:
objDesc object descriptor of published object

bool RIPCPrimitive::waitFor unsigned  timeout  )  [inline, inherited]
 

Wait until state of primitive is switched with timeout. Semantic of this method depends on particular primitive type and is explained in specification of each primitive.

Returns:
false if timeout is expired before primitive state is changed

void RIPCPrimitive::waitFor  )  [inline, inherited]
 

Wait until state of primitive is switched. Semantic of this method depends on particular primitive type and is explained in specification of each primitive.


The documentation for this class was generated from the following file:
Generated on Wed Nov 26 14:58:19 2003 for RIPC by doxygen 1.3.5