Image Component Library (ICL)
Public Member Functions | List of all members
icl::utils::Semaphore Class Reference

Simple Semaphore implementation wrapping the standard linux "sem_t"-struct. More...

#include <Semaphore.h>

Inheritance diagram for icl::utils::Semaphore:
icl::utils::ShallowCopyable< SemaphoreImpl, SemaphoreImplDelOp >

Public Member Functions

 Semaphore (int n=1)
 create a semaphore initialized with n resources More...
 
void operator++ (int dummy)
 releases a resource More...
 
void operator-- (int dummy)
 acquires a new resource More...
 
void operator+= (int val)
 releases val resources More...
 
void operator-= (int val)
 acquires val resources More...
 
void acquire (int val=1)
 releases val resources More...
 
void release (int val=1)
 acquires val resources More...
 
bool tryAcquire ()
 trys to acquire one resource if successfull it returns true else false More...
 
bool tryRelease ()
 releases one resource only if resources are aqcuired More...
 
int getValue ()
 returns the current value More...
 
int getMaxValue ()
 returns the semaphores max-value More...
 
- Public Member Functions inherited from icl::utils::ShallowCopyable< SemaphoreImpl, SemaphoreImplDelOp >
bool isNull () const
 returns wheter the objects implementation holds a null pointer More...
 

Additional Inherited Members

- Public Types inherited from icl::utils::ShallowCopyable< SemaphoreImpl, SemaphoreImplDelOp >
typedef ShallowCopyable< SemaphoreImpl, SemaphoreImplDelOp > ParentSC
 
- Protected Member Functions inherited from icl::utils::ShallowCopyable< SemaphoreImpl, SemaphoreImplDelOp >
 ShallowCopyable (SemaphoreImpl *t=0)
 create a the implementation with a given T* value More...
 
- Protected Attributes inherited from icl::utils::ShallowCopyable< SemaphoreImpl, SemaphoreImplDelOp >
SmartPtrBase< SemaphoreImpl, SemaphoreImplDelOp > impl
 shared pointer for the classes implementation More...
 

Detailed Description

Simple Semaphore implementation wrapping the standard linux "sem_t"-struct.

Constructor & Destructor Documentation

◆ Semaphore()

icl::utils::Semaphore::Semaphore ( int  n = 1)

create a semaphore initialized with n resources

Member Function Documentation

◆ acquire()

void icl::utils::Semaphore::acquire ( int  val = 1)
inline

releases val resources

◆ getMaxValue()

int icl::utils::Semaphore::getMaxValue ( )

returns the semaphores max-value

◆ getValue()

int icl::utils::Semaphore::getValue ( )

returns the current value

◆ operator++()

void icl::utils::Semaphore::operator++ ( int  dummy)

releases a resource

◆ operator+=()

void icl::utils::Semaphore::operator+= ( int  val)

releases val resources

◆ operator--()

void icl::utils::Semaphore::operator-- ( int  dummy)

acquires a new resource

◆ operator-=()

void icl::utils::Semaphore::operator-= ( int  val)

acquires val resources

◆ release()

void icl::utils::Semaphore::release ( int  val = 1)
inline

acquires val resources

◆ tryAcquire()

bool icl::utils::Semaphore::tryAcquire ( )

trys to acquire one resource if successfull it returns true else false

◆ tryRelease()

bool icl::utils::Semaphore::tryRelease ( )

releases one resource only if resources are aqcuired


The documentation for this class was generated from the following file: