Public Types | Public Member Functions | List of all members
iproc::IProcessor Class Referenceabstract

Interface for all synchrone and asynchrone processors with "push data" model. More...

#include <IProcessor.h>

Inheritance diagram for iproc::IProcessor:
istd::IPolymorphic icam::IBitmapAcquisition iedge::IEdgeLinesProcessor iedge::IEdgesExtractor iipr::ICaliperProcessor iipr::IFeatureToFeatureProcessor iipr::IImageToFeatureProcessor iipr::ILineProjectionProcessor imeas::IDataSequenceCorrelationProcessor imeas::IDataSequenceStatisticsProcessor imeas::ISampleAcquisition

Public Types

enum  MessageId { MI_BAD_PARAMS = 0x16372620, MI_PROCESSING_ERROR }
 
enum  ProcessorState { PS_UNKNOWN, PS_INITIALIZATION, PS_READY, PS_INVALID }
 State of processing. More...
 
enum  TaskState {
  TS_NONE, TS_WAIT, TS_OK, TS_CANCELED,
  TS_INVALID
}
 Describe state of task. More...
 

Public Member Functions

virtual int GetProcessorState (const iprm::IParamsSet *paramsPtr) const =0
 Get state of this processor for processing of specified parameters. More...
 
virtual bool AreParamsAccepted (const iprm::IParamsSet *paramsPtr, const istd::IPolymorphic *inputPtr, const istd::IChangeable *outputPtr) const =0
 Check if specified parameter set is accepted for this processor. More...
 
virtual int DoProcessing (const iprm::IParamsSet *paramsPtr, const istd::IPolymorphic *inputPtr, istd::IChangeable *outputPtr, ibase::IProgressManager *progressManagerPtr=NULL)=0
 Do synchronized processing. More...
 
virtual int BeginTask (const iprm::IParamsSet *paramsPtr, const istd::IPolymorphic *inputPtr, istd::IChangeable *outputPtr, ibase::IProgressManager *progressManagerPtr=NULL)=0
 Begin new task for this processor and add them to queue. More...
 
virtual int WaitTaskFinished (int taskId=-1, double timeoutTime=-1, bool killOnTimeout=true)=0
 Wait for task is finished. More...
 
virtual void CancelTask (int taskId=-1)=0
 Remove task from queue. More...
 
virtual int GetReadyTask ()=0
 Get the ID of any ready task. More...
 
virtual int GetTaskState (int taskId=-1) const =0
 Get actual task state. More...
 
virtual void InitProcessor (const iprm::IParamsSet *paramsPtr)=0
 Init processor to optimal process with specified params. More...
 

Detailed Description

Interface for all synchrone and asynchrone processors with "push data" model.

Synchrone processors are blocking and can process single task. Thats why is not necessary to use task ID. Synchrone processing is provide by method DoProcessing. Asynchrone processors can process many tasks parallel. Each task is identified using its ID. New asynchrone processing task can be started using method BeginTask and finish using WaitTaskFinished or CancelTask. Each task has its input object, output object and parameter set.

Parameters
Inputtype of input object.
Outputtype of output object.

Definition at line 24 of file IProcessor.h.

Member Enumeration Documentation

Enumerator
MI_BAD_PARAMS 

Bad processor parameter.

MI_PROCESSING_ERROR 

Definition at line 27 of file IProcessor.h.

State of processing.

Enumerator
PS_UNKNOWN 

Processing state is unknown or not initialized.

PS_INITIALIZATION 

Processor is during initalisation.

PS_READY 

Processor is initialized and ready.

PS_INVALID 

Processor cannot be initialized.

Definition at line 39 of file IProcessor.h.

Describe state of task.

Enumerator
TS_NONE 

Task state is undefined.

TS_WAIT 

Task is during execution.

TS_OK 

Task finished correctly.

TS_CANCELED 

Task was canceled by user.

TS_INVALID 

Task finished but an error is occured.

Definition at line 62 of file IProcessor.h.

Member Function Documentation

virtual bool iproc::IProcessor::AreParamsAccepted ( const iprm::IParamsSet paramsPtr,
const istd::IPolymorphic inputPtr,
const istd::IChangeable outputPtr 
) const
pure virtual

Check if specified parameter set is accepted for this processor.

Parameters
inputPtroptional input object typically being source object used to processing.
outputPtroptional output object storing processing result.
Returns
task ID or -1 if it was not possible to add new task.

Implemented in icam::CCameraDelegatorComp, icam::CSelectionParamCameraComp, iproc::TSyncProcessorWrap< icam::IBitmapAcquisition >, and iproc::TSyncProcessorWrap< iipr::IImageToFeatureProcessor >.

virtual int iproc::IProcessor::BeginTask ( const iprm::IParamsSet paramsPtr,
const istd::IPolymorphic inputPtr,
istd::IChangeable outputPtr,
ibase::IProgressManager progressManagerPtr = NULL 
)
pure virtual

Begin new task for this processor and add them to queue.

If this method success, new task is added into the queue. To remove it from queue you have to call WaitTaskFinished or CancelTask.

Parameters
paramsPtrset of parameters controlling processing task. Pointed object can be used till task is finished. It can be NULL.
inputPtrinput object typically being source object used to processing. Pointed object can be used till task is finished. It can be NULL.
outputPtroutput object storing processing result. Pointed object can be used till task is finished. It can be NULL.
Returns
task ID or -1 if it was not possible to add new task.

Implemented in icam::CCameraDelegatorComp, icam::CSelectionParamCameraComp, iproc::TSyncProcessorWrap< icam::IBitmapAcquisition >, and iproc::TSyncProcessorWrap< iipr::IImageToFeatureProcessor >.

virtual void iproc::IProcessor::CancelTask ( int  taskId = -1)
pure virtual

Remove task from queue.

Parameters
taskIdID of task returned by BeginTask() or -1 if all tasks are mean.

Implemented in icam::CCameraDelegatorComp, icam::CSelectionParamCameraComp, iproc::TSyncProcessorWrap< icam::IBitmapAcquisition >, and iproc::TSyncProcessorWrap< iipr::IImageToFeatureProcessor >.

virtual int iproc::IProcessor::DoProcessing ( const iprm::IParamsSet paramsPtr,
const istd::IPolymorphic inputPtr,
istd::IChangeable outputPtr,
ibase::IProgressManager progressManagerPtr = NULL 
)
pure virtual
virtual int iproc::IProcessor::GetProcessorState ( const iprm::IParamsSet paramsPtr) const
pure virtual

Get state of this processor for processing of specified parameters.

Parameters
paramsPtrpointer to parameter object or NULL if general state is mean.
Returns
state of this processor
See Also
ProcessorState.

Implemented in icam::CCameraDelegatorComp, icam::CSelectionParamCameraComp, iproc::TSyncProcessorWrap< icam::IBitmapAcquisition >, and iproc::TSyncProcessorWrap< iipr::IImageToFeatureProcessor >.

virtual int iproc::IProcessor::GetReadyTask ( )
pure virtual

Get the ID of any ready task.

Also for ready task it is necessary to call WaitTaskFinished().

Returns
ID of ready task or -1.

Implemented in icam::CCameraDelegatorComp, iproc::TSyncProcessorWrap< icam::IBitmapAcquisition >, and iproc::TSyncProcessorWrap< iipr::IImageToFeatureProcessor >.

virtual int iproc::IProcessor::GetTaskState ( int  taskId = -1) const
pure virtual

Get actual task state.

Please note that task state will be only stored till WaitTaskFinished() is called.

Parameters
taskIdtask ID number returned by BeginTask() method. If it is -1 state of the last task will be returned.
Returns
state of selected task or all tasks
See Also
TaskState.

Implemented in icam::CCameraDelegatorComp, iproc::TSyncProcessorWrap< icam::IBitmapAcquisition >, and iproc::TSyncProcessorWrap< iipr::IImageToFeatureProcessor >.

virtual void iproc::IProcessor::InitProcessor ( const iprm::IParamsSet paramsPtr)
pure virtual

Init processor to optimal process with specified params.

Please note, that initalizing will be also done automatically in method BeginTask but, to avoid unpredictable waiting time during time critical processing, it is recommended to use this method while parameter initialization.

Parameters
paramsPtrset of parameters controlling processing task. Pointed object can be used till task is finished. It can be NULL.

Implemented in icam::CCameraDelegatorComp, icam::CSelectionParamCameraComp, iproc::TSyncProcessorWrap< icam::IBitmapAcquisition >, and iproc::TSyncProcessorWrap< iipr::IImageToFeatureProcessor >.

virtual int iproc::IProcessor::WaitTaskFinished ( int  taskId = -1,
double  timeoutTime = -1,
bool  killOnTimeout = true 
)
pure virtual

Wait for task is finished.

Parameters
taskIdID of task returned by BeginTask() or -1 if all tasks are mean.
timeoutTimemaximal waiting time in seconds or negative value if timeout is not allowed. If this time will be exceeded, it returns TS_WAIT or TS_INVALID if killOnTimeout is set.
killOnTimeoutindicate that task must be killed by timeout.
Returns
state of selected task or all tasks
See Also
TaskState.

Implemented in icam::CCameraDelegatorComp, icam::CSelectionParamCameraComp, iproc::TSyncProcessorWrap< icam::IBitmapAcquisition >, and iproc::TSyncProcessorWrap< iipr::IImageToFeatureProcessor >.


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

© 2007-2017 Witold Gantzke and Kirill Lepskiy