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

PLearn::CountEventsSemaphore Class Reference

#include <Semaphores.h>

Collaboration diagram for PLearn::CountEventsSemaphore:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CountEventsSemaphore (int nb_semaphores=1)
 construct given number of semaphores for event counters

 CountEventsSemaphore (SemId semid)
 access an existing semaphore

void signal (int type=0)
 Signal the occurence of event of given "type", where type can range from 0 to n_semaphores-1.

void wait (int n_occurences, int type=0)
int value (int type=0)
 return current value of counter for given "type" of event

void setValue (int value, int resource=0)
 set value of counter

 ~CountEventsSemaphore ()
 release the semaphore upon destruction of object


Protected Attributes

SemId id
 semaphore id provided by the operating system at construction

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

int n_semaphores
 there can be several semaphores in the same object


Constructor & Destructor Documentation

PLearn::CountEventsSemaphore::CountEventsSemaphore int  nb_semaphores = 1  ) 
 

construct given number of semaphores for event counters

Definition at line 137 of file Semaphores.cc.

References PLearn::endl(), n_semaphores, PLERROR, and PLearn::semun::val.

PLearn::CountEventsSemaphore::CountEventsSemaphore SemId  semid  ) 
 

access an existing semaphore

Definition at line 160 of file Semaphores.cc.

References n_semaphores, and PLERROR.

PLearn::CountEventsSemaphore::~CountEventsSemaphore  ) 
 

release the semaphore upon destruction of object

Definition at line 215 of file Semaphores.cc.

References PLearn::endl(), owner, PLERROR, and PLearn::semun::val.


Member Function Documentation

void PLearn::CountEventsSemaphore::setValue int  value,
int  resource = 0
 

set value of counter

Definition at line 206 of file Semaphores.cc.

References PLERROR, and PLearn::semun::val.

void PLearn::CountEventsSemaphore::signal int  type = 0  ) 
 

Signal the occurence of event of given "type", where type can range from 0 to n_semaphores-1.

No waiting.

Definition at line 173 of file Semaphores.cc.

References PLERROR.

int PLearn::CountEventsSemaphore::value int  type = 0  ) 
 

return current value of counter for given "type" of event

Definition at line 185 of file Semaphores.cc.

References PLearn::semun::val.

void PLearn::CountEventsSemaphore::wait int  n_occurences,
int  type = 0
 

Wait for n_occurences of event of given "type" to have occured, where "type" can range from 0 to n_semaphoes-1. When this occurs, the event count for this type of event is reset to 0.

Definition at line 191 of file Semaphores.cc.

References PLERROR.


Member Data Documentation

SemId PLearn::CountEventsSemaphore::id [protected]
 

semaphore id provided by the operating system at construction

Definition at line 133 of file Semaphores.h.

int PLearn::CountEventsSemaphore::n_semaphores [protected]
 

there can be several semaphores in the same object

Definition at line 136 of file Semaphores.h.

Referenced by CountEventsSemaphore().

bool PLearn::CountEventsSemaphore::owner [protected]
 

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

the semaphore will be released with this object is deleted

Definition at line 134 of file Semaphores.h.

Referenced by ~CountEventsSemaphore().


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