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

PLearn::SharedMemory< T > Class Template Reference

#include <Semaphores.h>

Collaboration diagram for PLearn::SharedMemory< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SharedMemory (int n_items=1)
 allocate shared memory

 SharedMemory (SemId semid)
 access an existing shared memory area

T * data () const
 convert to address of beginning of shared memory segment

int size () const
 ~SharedMemory ()
 release id and memory


Protected Attributes

SemId id
 shared memory id provided by the operating system at construction

bool owner
 true if this process is the owner of the shared memory, i.e

int size_
 in number of bytes

T * segment
 allocated segment

template<class T>
class PLearn::SharedMemory< T >


Constructor & Destructor Documentation

template<class T>
PLearn::SharedMemory< T >::SharedMemory int  n_items = 1  )  [inline]
 

allocate shared memory

Definition at line 176 of file Semaphores.h.

References PLearn::SharedMemory< T >::owner, PLERROR, PLearn::SharedMemory< T >::segment, and PLearn::SharedMemory< T >::size_.

template<class T>
PLearn::SharedMemory< T >::SharedMemory SemId  semid  )  [inline]
 

access an existing shared memory area

Definition at line 189 of file Semaphores.h.

References PLearn::SharedMemory< T >::id, PLearn::SharedMemory< T >::owner, PLERROR, PLearn::SharedMemory< T >::segment, and PLearn::SharedMemory< T >::size_.

template<class T>
PLearn::SharedMemory< T >::~SharedMemory  )  [inline]
 

release id and memory

Definition at line 205 of file Semaphores.h.

References PLearn::endl(), PLearn::SharedMemory< T >::owner, PLERROR, and PLearn::SharedMemory< T >::segment.


Member Function Documentation

template<class T>
T* PLearn::SharedMemory< T >::data  )  const [inline]
 

convert to address of beginning of shared memory segment

Definition at line 200 of file Semaphores.h.

References PLearn::SharedMemory< T >::segment.

template<class T>
int PLearn::SharedMemory< T >::size  )  const [inline]
 

Definition at line 202 of file Semaphores.h.

References PLearn::SharedMemory< T >::size_.


Member Data Documentation

template<class T>
SemId PLearn::SharedMemory< T >::id [protected]
 

shared memory id provided by the operating system at construction

Definition at line 169 of file Semaphores.h.

Referenced by PLearn::SharedMemory< T >::SharedMemory().

template<class T>
bool PLearn::SharedMemory< T >::owner [protected]
 

true if this process is the owner of the shared memory, i.e

the shared memory will be released with this object is deleted

Definition at line 170 of file Semaphores.h.

Referenced by PLearn::SharedMemory< T >::SharedMemory(), and PLearn::SharedMemory< T >::~SharedMemory().

template<class T>
T* PLearn::SharedMemory< T >::segment [protected]
 

allocated segment

Definition at line 173 of file Semaphores.h.

Referenced by PLearn::SharedMemory< T >::data(), PLearn::SharedMemory< T >::SharedMemory(), and PLearn::SharedMemory< T >::~SharedMemory().

template<class T>
int PLearn::SharedMemory< T >::size_ [protected]
 

in number of bytes

Definition at line 172 of file Semaphores.h.

Referenced by PLearn::SharedMemory< T >::SharedMemory(), and PLearn::SharedMemory< T >::size().


The documentation for this class was generated from the following file:
Generated on Tue Aug 17 16:24:36 2004 for PLearn by doxygen 1.3.7