Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Protected Attributes | List of all members
BIAS::ProgressSemaphore Class Reference

this class represents a progress counter which multiple processes can use. More...

#include <Base/Common/ProgressSemaphore.hh>

Public Member Functions

float GetProgress ()
 returns current progress state in standard intervall More...
 
void IncrementStep ()
 Increment the current step. More...
 
bool IsTerminationRequested ()
 Tells whether the termination flag is set. More...
 
 ProgressSemaphore ()
 
void Reset ()
 Resets all values. More...
 
void ResetTerminateFlag ()
 Chancels the termination flag. More...
 
void SetCurrentStep (unsigned int CurrentStep)
 Set the current step. More...
 
void SetNumSteps (unsigned int steps)
 Set the number of steps to progress will need to complete. More...
 
void SetTerminateFlag ()
 Sets a termination flag to inform e.g. More...
 
 ~ProgressSemaphore ()
 destructor More...
 

Protected Attributes

unsigned int CurrentStep_
 
pthread_mutex_t Lock_
 
unsigned int NumSteps_
 
bool Terminate_
 

Detailed Description

this class represents a progress counter which multiple processes can use.

It is implemented using locked access to the progress variables using pthread mutexes An example is that one thread starts a progress and has to wait till this progress is done and wants to display a progress bar. In the meanwhile the working progress can update the progress values in the ProgressSemaphore to inform the waiting progress about its progress.

Author
evers 03/2008

Definition at line 45 of file ProgressSemaphore.hh.

Constructor & Destructor Documentation

ProgressSemaphore::ProgressSemaphore ( )

Definition at line 31 of file ProgressSemaphore.cpp.

References Lock_, and Reset().

ProgressSemaphore::~ProgressSemaphore ( )

destructor

Definition at line 40 of file ProgressSemaphore.cpp.

Member Function Documentation

float ProgressSemaphore::GetProgress ( )

returns current progress state in standard intervall

Examples:
ExampleProgressSemaphore.cpp.

Definition at line 44 of file ProgressSemaphore.cpp.

References CurrentStep_, Lock_, and NumSteps_.

void ProgressSemaphore::IncrementStep ( )

Increment the current step.

Definition at line 86 of file ProgressSemaphore.cpp.

References CurrentStep_, Lock_, and NumSteps_.

bool ProgressSemaphore::IsTerminationRequested ( )

Tells whether the termination flag is set.

Definition at line 121 of file ProgressSemaphore.cpp.

References Lock_, and Terminate_.

void ProgressSemaphore::Reset ( )

Resets all values.

Definition at line 134 of file ProgressSemaphore.cpp.

References CurrentStep_, Lock_, NumSteps_, and Terminate_.

Referenced by ProgressSemaphore().

void ProgressSemaphore::ResetTerminateFlag ( )

Chancels the termination flag.

Definition at line 110 of file ProgressSemaphore.cpp.

References Lock_, and Terminate_.

void ProgressSemaphore::SetCurrentStep ( unsigned int  CurrentStep)

Set the current step.

Examples:
ExampleProgressSemaphore.cpp.

Definition at line 74 of file ProgressSemaphore.cpp.

References CurrentStep_, Lock_, and NumSteps_.

void ProgressSemaphore::SetNumSteps ( unsigned int  steps)

Set the number of steps to progress will need to complete.

Examples:
ExampleProgressSemaphore.cpp.

Definition at line 62 of file ProgressSemaphore.cpp.

References Lock_, and NumSteps_.

void ProgressSemaphore::SetTerminateFlag ( )

Sets a termination flag to inform e.g.

another process that an abort is requested

Definition at line 99 of file ProgressSemaphore.cpp.

References Lock_, and Terminate_.

Member Data Documentation

unsigned int BIAS::ProgressSemaphore::CurrentStep_
protected

Definition at line 74 of file ProgressSemaphore.hh.

Referenced by GetProgress(), IncrementStep(), Reset(), and SetCurrentStep().

pthread_mutex_t BIAS::ProgressSemaphore::Lock_
protected
unsigned int BIAS::ProgressSemaphore::NumSteps_
protected

Definition at line 73 of file ProgressSemaphore.hh.

Referenced by GetProgress(), IncrementStep(), Reset(), SetCurrentStep(), and SetNumSteps().

bool BIAS::ProgressSemaphore::Terminate_
protected

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