mta::MultiThreadReporter Class Reference

Communicates between a processing thread and the main thread. More...

#include <MultiThreadedAlgorithm.h>

Inheritance diagram for mta::MultiThreadReporter:

Inheritance graph

List of all members.

Public Types

enum  ReportTypeEnum {
  THREAD_NO_REPORT = 0x0, THREAD_PROGRESS = 0x1, THREAD_ERROR = 0x2, THREAD_COMPLETE = 0x4,
  THREAD_WORK = 0x8
}
typedef EnumWrapper
< ReportTypeEnum
ReportType

Public Member Functions

 MultiThreadReporter (int threadCount, Result *pResult, BMutex &mutexA, BThreadSignal &signalA, BMutex &mutexB, BThreadSignal &signalB)
virtual ~MultiThreadReporter ()
 MultiThreadReporter (MultiThreadReporter &reporter)
Result reportProgress (int threadIndex, int percentDone)
Result reportCompletion (int threadIndex)
Result reportError (std::string errorText)
int getProgress () const
int getProgress (int threadIndex) const
std::string getErrorText () const
void runInMainThread (ThreadCommand &command)
void setReportType (ReportType type)
unsigned int getReportType () const
ThreadCommandgetThreadCommand ()


Detailed Description

Communicates between a processing thread and the main thread.

Definition at line 132 of file MultiThreadedAlgorithm.h.


Member Typedef Documentation

The EnumWrapper contains a given enum value and provides a isValid() method which returns true if the contained enum value is valid.

Please see How To Use EnumWrapper for more information. The wrapped enum values are MultiThreadReporter::ReportTypeEnum.

Definition at line 150 of file MultiThreadedAlgorithm.h.


Member Enumeration Documentation

Messages sent between threads.

Enumerator:
THREAD_NO_REPORT 
THREAD_PROGRESS 
THREAD_ERROR 
THREAD_COMPLETE 
THREAD_WORK 

Definition at line 138 of file MultiThreadedAlgorithm.h.


Constructor & Destructor Documentation

mta::MultiThreadReporter::MultiThreadReporter ( int  threadCount,
Result pResult,
BMutex &  mutexA,
BThreadSignal &  signalA,
BMutex &  mutexB,
BThreadSignal &  signalB 
)

Constructor.

Parameters:
threadCount The number of threads to executre.
pResult The result of execution will be stored here.
mutexA The first mutex used to coordinate the threads.
signalA The first signal used to coordinate the threads.
mutexB The second mutex used to coordinate the threads.
signalB The second signal used to coordinate the threads.

virtual mta::MultiThreadReporter::~MultiThreadReporter (  )  [virtual]

Destructor.

Definition at line 174 of file MultiThreadedAlgorithm.h.

mta::MultiThreadReporter::MultiThreadReporter ( MultiThreadReporter reporter  ) 

Copy constructor.

Parameters:
reporter The other


Member Function Documentation

Result mta::MultiThreadReporter::reportProgress ( int  threadIndex,
int  percentDone 
) [virtual]

Send a progress report form a thread.

Parameters:
threadIndex ID number for the current thread.
percentDone How much of this thread's progress has completed.
Returns:
The result of the operation.

Implements mta::ThreadReporter.

Result mta::MultiThreadReporter::reportCompletion ( int  threadIndex  )  [virtual]

Indicate that a thread has completed execution.

Parameters:
threadIndex ID number for the current thread.
Returns:
The result of the operation.

Implements mta::ThreadReporter.

Result mta::MultiThreadReporter::reportError ( std::string  errorText  )  [virtual]

Report an error.

Parameters:
errorText Description of the error.
Returns:
The result of the operation.

Implements mta::ThreadReporter.

int mta::MultiThreadReporter::getProgress (  )  const

Get the current thread's progress.

Returns:
Percent complete for the current thread.

int mta::MultiThreadReporter::getProgress ( int  threadIndex  )  const [virtual]

Access the progress of a thread.

Parameters:
threadIndex The ID of the thread to check.
Returns:
Percent complete for the thread.

Implements mta::ThreadReporter.

std::string mta::MultiThreadReporter::getErrorText (  )  const [virtual]

Access the most recent error.

Returns:
The description of the most recent error.

Implements mta::ThreadReporter.

void mta::MultiThreadReporter::runInMainThread ( ThreadCommand command  )  [virtual]

Perform an action in the main thread.

Parameters:
command The action to run in the main thread.

Implements mta::ThreadReporter.

void mta::MultiThreadReporter::setReportType ( ReportType  type  ) 

Set the type of report.

Parameters:
type The report type.

unsigned int mta::MultiThreadReporter::getReportType (  )  const

Access the report type.

Returns:
The report type.

ThreadCommand* mta::MultiThreadReporter::getThreadCommand (  ) 

Access the current thread command.

Returns:
The current thread command.


Software Development Kit - Opticks 4.9.0 Build 16218