PARP Research Group | Universidad de Murcia |
QVProcessingBlock Class Reference
|
Public Types | |
enum | TBlockStatus { Running, RunningOneStep, Paused, Stopped, Finished } |
Different states in which a block object can be. More... | |
Public Slots | |
void | pause () |
Set block status to QVProcessingBlock::Paused. | |
void | unPause () |
Set block status to QVProcessingBlock::Running. | |
void | step () |
Set block status to QVProcessingBlock::RunningOneStep. | |
void | stop () |
Finish block execution. | |
void | finish () |
Finish block execution. | |
virtual void | processTrigger (const QString name) |
Process trigger activations in the block. | |
Signals | |
void | startIteration () |
Signal emited before each call to QVProcessingBlock::iterate() function. | |
void | endIteration (uint id, int iteration) |
Signal emited after each call to QVProcessingBlock::iterate() function. | |
void | statusUpdate (QVProcessingBlock::TBlockStatus) |
Signal emited when block changes its status. | |
Public Member Functions | |
QVProcessingBlock (const QString name=QString()) | |
Constructor for QVProcessingBlock class. | |
QVProcessingBlock (const QVProcessingBlock &other) | |
Copy Constructor for the QVProcessingBlock class. | |
~QVProcessingBlock () | |
Destructor for QVProcessingBlock class. | |
virtual void | iterate () |
Function to be defined in subclasses with processing code. | |
void | setMinimumDelay (int ms) |
Sets a minimum ms delay for each iteration (default is 0). | |
bool | isFinished () const |
Function that can be used to check finish status of block. | |
bool | isPaused () const |
Function that can be used to check paused status of block. | |
bool | isStopped () const |
Function that can be used to check stopped status of block. | |
bool | isRunning () const |
Function that can be used to check running status of block. | |
TBlockStatus | getStatus () const |
Function to obtain the status of the block. | |
int | getIteration () const |
Function to obtain the number of iteration the block has performed. | |
bool | isStatsEnabled () const |
Function to obtain if the stats are enabled. | |
QVStat | getCpuStat () const |
Gets CpuStat object for the block. | |
void | setPrintStatsFrequency (int freq) |
Prints CpuStat object for the block. | |
void | printStats () |
Prints CpuStat object for the block. | |
void | addTrigger (QString name) |
Adds a trigger to the block. | |
const QStringList | getTriggerList () const |
Returns the list of triggers (as a QStringList) for the block. | |
void | timeFlag (const QString flag) |
Stablish a performance breakpoint in the execution of the block. |
Base class for Block threads.
This class can be used to construct processing blocks for the Further reading about block programming: The Worker design pattern. Block threads classes should inherit from QVProcessingBlock, and implement abstract function QVProcessingBlock::iterate, with the body of the function code
For further info about block programming see section IntroductionToBlockProgramming.
Definition at line 45 of file qvprocessingblock.h.
Different states in which a block object can be.
Running |
Block is running. QVProcessingBlock::iterate() function will be called continuously, until slots pause() or finish() are called. |
RunningOneStep |
Block will execute QVProcessingBlock::iterate() function once, and then will change to Paused status. |
Paused |
Block is paused. It won't call function QVProcessingBlock::iterate(), or finish execution thread, until slots unPause() or finish() are called respectively. |
Stopped |
Block is stopped. It won't call function QVProcessingBlock::iterate() (but don't block its conected sychronous blocks), or finish execution thread, until slots finish() are called respectively. |
Finished |
Block is finished. Execution thread ended. |
Definition at line 51 of file qvprocessingblock.h.
QVProcessingBlock::QVProcessingBlock | ( | const QString | name = QString() |
) |
Constructor for QVProcessingBlock class.
Inits block, and set it's status to Running.
name | the (optional) name given to the block. |
Definition at line 35 of file qvprocessingblock.cpp.
QVProcessingBlock::QVProcessingBlock | ( | const QVProcessingBlock & | other | ) |
Copy Constructor for the QVProcessingBlock class.
Creates a new block form a given block.
other | the given block. |
Definition at line 71 of file qvprocessingblock.cpp.
QVProcessingBlock::~QVProcessingBlock | ( | ) |
Destructor for QVProcessingBlock class.
Definition at line 78 of file qvprocessingblock.cpp.
virtual void QVProcessingBlock::iterate | ( | ) | [inline, virtual] |
Function to be defined in subclasses with processing code.
This function should contain the code to process data, that will be executed continuously until block is finished.
Reimplemented in QVYUV4MPEG2WriterBlock, QVCannyEdgeDetector, QVHarrisPointDetector, QVConvert_uCharsFloatC1Block, QVConvert_uCharsFloatC3Block, QVConvert_sFloatuCharC1Block, QVConvert_sFloatuCharC3Block, QVAdd_uCharC1Block, QVAdd_uCharC3Block, QVAdd_sFloatC1Block, QVAdd_sFloatC3Block, QVAddC_uCharC1Block, QVAddC_sFloatC1Block, QVMul_uCharC1Block, QVMul_uCharC3Block, QVMul_sFloatC3Block, QVMul_sFloatC1Block, QVMulC_uCharC1Block, QVMulC_sFloatC1Block, QVMulScale_uCharC1Block, QVMulScale_uCharC3Block, QVSub_uCharC1Block, QVSub_uCharC3Block, QVSub_sFloatC1Block, QVSub_sFloatC3Block, QVSubC_uCharC1Block, QVSubC_sFloatC1Block, QVDiv_uCharC1Block, QVDiv_uCharC3Block, QVDiv_sFloatC3Block, QVDiv_sFloatC1Block, QVDivC_uCharC1Block, QVDivC_sFloatC1Block, QVAbs_sShortC1Block, QVAbs_sFloatC1Block, QVAbsDiff_uCharC1Block, QVAbsDiff_sFloatC1Block, QVSqr_sFloatC1Block, QVLn_sFloatC1Block, QVLn_sFloatC3Block, QVAnd_uCharC1Block, QVAnd_uCharC3Block, QVAnd_uShortC1Block, QVAnd_uShortC3Block, QVAnd_sIntC1Block, QVAnd_sIntC3Block, QVOr_uCharC1Block, QVOr_uCharC3Block, QVOr_uShortC1Block, QVOr_uShortC3Block, QVOr_sIntC1Block, QVOr_sIntC3Block, QVXor_uCharC1Block, QVXor_uCharC3Block, QVXor_uShortC1Block, QVXor_uShortC3Block, QVXor_sIntC1Block, QVXor_sIntC3Block, QVNot_uCharC1Block, QVNot_uCharC3Block, QVAndC_uCharC1Block, QVOrC_uCharC1Block, QVXorC_uCharC1Block, QVLShiftC_uCharC1Block, QVRShiftC_uCharC1Block, QVRGBToGray_uCharC3C1Block, QVRGBToGray_sFloatC3C1Block, QVThreshold_uCharC1Block, QVThreshold_sFloatC1Block, QVComputeThreshold_Otsu_uCharC1Block, QVCompare_uCharC1Block, QVCompare_sFloatC1Block, QVCompareC_uCharC1Block, QVCompareC_sFloatC1Block, QVFilterBox_uCharC1Block, QVFilterBox_uCharC3Block, QVFilterBox_sFloatC1Block, QVFilterMin_uCharC1Block, QVFilterMin_uCharC3Block, QVFilterMin_sFloatC1Block, QVFilterMax_uCharC1Block, QVFilterMax_uCharC3Block, QVFilterMax_sFloatC1Block, QVFilterMedian_uCharC1Block, QVFilterMedian_uCharC3Block, QVFilterMedianHoriz_uCharC1Block, QVFilterSobelHorizMask_sFloatC1Block, QVFilterSobelVertMask_sFloatC1Block, QVFilterLaplace_uCharC1Block, QVFilterLaplace_sFloatC1Block, QVFilterGauss_uCharC1Block, QVFilterGauss_sFloatC1Block, QVFilterGauss_uCharC3Block, QVFilterGauss_sFloatC3Block, QVFilterHipass_uCharC1Block, QVFilterHipass_uCharC3Block, QVFilterHipass_sFloatC1Block, QVFilterHipass_sFloatC3Block, QVFilterLowpass_uCharC1Block, QVFilterLowpass_sFloatC1Block, QVSum_uCharC1Block, QVMean_uCharC1Block, QVMin_uCharC1Block, QVMin_sFloatC1Block, QVMax_uCharC1Block, QVMax_sFloatC1Block, and QVMSERDetector.
Definition at line 91 of file qvprocessingblock.h.
void QVProcessingBlock::setMinimumDelay | ( | int | ms | ) | [inline] |
Sets a minimum ms delay for each iteration (default is 0).
This function should be called to establish a minimum delay for each iteration (that is, it should be used to limit the speed at which the block iterates). Of course, if the real processing iteration time is longer than the delay set with this function, it will not have any visible effect.
Warning: due to underlying operating system time management imprecissions, low values (typically under 40 ms) of this parameter can result in longer delays than expected.
Definition at line 104 of file qvprocessingblock.h.
bool QVProcessingBlock::isFinished | ( | ) | const [inline] |
Function that can be used to check finish status of block.
Definition at line 108 of file qvprocessingblock.h.
bool QVProcessingBlock::isPaused | ( | ) | const [inline] |
Function that can be used to check paused status of block.
Definition at line 112 of file qvprocessingblock.h.
bool QVProcessingBlock::isStopped | ( | ) | const [inline] |
Function that can be used to check stopped status of block.
Definition at line 116 of file qvprocessingblock.h.
bool QVProcessingBlock::isRunning | ( | ) | const [inline] |
Function that can be used to check running status of block.
Definition at line 120 of file qvprocessingblock.h.
TBlockStatus QVProcessingBlock::getStatus | ( | ) | const [inline] |
Function to obtain the status of the block.
Definition at line 124 of file qvprocessingblock.h.
int QVProcessingBlock::getIteration | ( | ) | const [inline] |
Function to obtain the number of iteration the block has performed.
Definition at line 128 of file qvprocessingblock.h.
bool QVProcessingBlock::isStatsEnabled | ( | ) | const [inline] |
Function to obtain if the stats are enabled.
Definition at line 132 of file qvprocessingblock.h.
QVStat QVProcessingBlock::getCpuStat | ( | ) | const [inline] |
Gets CpuStat object for the block.
Every block has a CpuStat type object that mantains cpu time performance for different parts (code fragments) of function iterate(). This object is updated in method timeFlag(), when establishing a performance breakpoint in the execution of the block.
If th stats are disabled, return an empty QVStat.
Definition at line 144 of file qvprocessingblock.h.
void QVProcessingBlock::setPrintStatsFrequency | ( | int | freq | ) | [inline] |
Prints CpuStat object for the block.
Periodically prints performance statistics for the block. If the stats are disabled, do nothing.
freq | The frequency (iterations) whitch prints the stats. |
Definition at line 156 of file qvprocessingblock.h.
Referenced by QVProcessingBlock().
void QVProcessingBlock::printStats | ( | ) | [inline] |
Prints CpuStat object for the block.
Prints performance statistics for the block. If the stats are disabled, do nothing.
Definition at line 171 of file qvprocessingblock.h.
void QVProcessingBlock::addTrigger | ( | QString | name | ) | [inline] |
Adds a trigger to the block.
Triggers are just named actions that can be called upon a QVProcessingBlock to change it's state, initialize itself, or whatever action the programmer considers convenient, in a completely asynchronous manner. When added to a block, they will depict a button in the corresponding property widget in the interface, that will do a call to processTrigger() function when pressed.
This method is provided just for convenience. The same effect could be achieved just by adding a new slot when subclassing QVProcessingBlock, and connecting it to a button clicked signal. But using this generic function avoids the programmer to have to declare the new block class as a Q_OBJECT, if he just needs the trigger functionality, and does not want to declare any other signals or slots in his new block class.
Definition at line 195 of file qvprocessingblock.h.
const QStringList QVProcessingBlock::getTriggerList | ( | ) | const [inline] |
Returns the list of triggers (as a QStringList) for the block.
Definition at line 198 of file qvprocessingblock.h.
void QVProcessingBlock::timeFlag | ( | const QString | flag | ) | [inline] |
Stablish a performance breakpoint in the execution of the block.
This function should be used in the body of iterate() function, to establish a performance breakpoint, at which the execution time will be statistically measured.
If the stats are disabled, do nothing.
These statistics can be plotted through the graphical user interface (see BlockWidget section at the QVGUI documentation), creating a QVCPUPlot object, or to the user console if the parameter --"print stats"=true was used in the application command line.
Definition at line 212 of file qvprocessingblock.h.
Referenced by QVMax_sFloatC1Block::iterate(), QVMax_uCharC1Block::iterate(), QVMin_sFloatC1Block::iterate(), QVMin_uCharC1Block::iterate(), QVMean_uCharC1Block::iterate(), QVSum_uCharC1Block::iterate(), QVFilterLowpass_sFloatC1Block::iterate(), QVFilterLowpass_uCharC1Block::iterate(), QVFilterHipass_sFloatC3Block::iterate(), QVFilterHipass_sFloatC1Block::iterate(), QVFilterHipass_uCharC3Block::iterate(), QVFilterHipass_uCharC1Block::iterate(), QVFilterGauss_sFloatC3Block::iterate(), QVFilterGauss_uCharC3Block::iterate(), QVFilterGauss_sFloatC1Block::iterate(), QVFilterGauss_uCharC1Block::iterate(), QVFilterLaplace_sFloatC1Block::iterate(), QVFilterLaplace_uCharC1Block::iterate(), QVFilterSobelVertMask_sFloatC1Block::iterate(), QVFilterSobelHorizMask_sFloatC1Block::iterate(), QVFilterMedianHoriz_uCharC1Block::iterate(), QVFilterMedian_uCharC3Block::iterate(), QVFilterMedian_uCharC1Block::iterate(), QVFilterMax_sFloatC1Block::iterate(), QVFilterMax_uCharC3Block::iterate(), QVFilterMax_uCharC1Block::iterate(), QVFilterMin_sFloatC1Block::iterate(), QVFilterMin_uCharC3Block::iterate(), QVFilterMin_uCharC1Block::iterate(), QVFilterBox_sFloatC1Block::iterate(), QVFilterBox_uCharC3Block::iterate(), QVFilterBox_uCharC1Block::iterate(), QVCompareC_sFloatC1Block::iterate(), QVCompareC_uCharC1Block::iterate(), QVCompare_sFloatC1Block::iterate(), QVCompare_uCharC1Block::iterate(), QVComputeThreshold_Otsu_uCharC1Block::iterate(), QVThreshold_sFloatC1Block::iterate(), QVThreshold_uCharC1Block::iterate(), QVRGBToGray_sFloatC3C1Block::iterate(), QVRGBToGray_uCharC3C1Block::iterate(), QVRShiftC_uCharC1Block::iterate(), QVLShiftC_uCharC1Block::iterate(), QVXorC_uCharC1Block::iterate(), QVOrC_uCharC1Block::iterate(), QVAndC_uCharC1Block::iterate(), QVNot_uCharC3Block::iterate(), QVNot_uCharC1Block::iterate(), QVXor_sIntC3Block::iterate(), QVXor_sIntC1Block::iterate(), QVXor_uShortC3Block::iterate(), QVXor_uShortC1Block::iterate(), QVXor_uCharC3Block::iterate(), QVXor_uCharC1Block::iterate(), QVOr_sIntC3Block::iterate(), QVOr_sIntC1Block::iterate(), QVOr_uShortC3Block::iterate(), QVOr_uShortC1Block::iterate(), QVOr_uCharC3Block::iterate(), QVOr_uCharC1Block::iterate(), QVAnd_sIntC3Block::iterate(), QVAnd_sIntC1Block::iterate(), QVAnd_uShortC3Block::iterate(), QVAnd_uShortC1Block::iterate(), QVAnd_uCharC3Block::iterate(), QVAnd_uCharC1Block::iterate(), QVLn_sFloatC3Block::iterate(), QVLn_sFloatC1Block::iterate(), QVSqr_sFloatC1Block::iterate(), QVAbsDiff_sFloatC1Block::iterate(), QVAbsDiff_uCharC1Block::iterate(), QVAbs_sFloatC1Block::iterate(), QVAbs_sShortC1Block::iterate(), QVDivC_sFloatC1Block::iterate(), QVDivC_uCharC1Block::iterate(), QVDiv_sFloatC1Block::iterate(), QVDiv_sFloatC3Block::iterate(), QVDiv_uCharC3Block::iterate(), QVDiv_uCharC1Block::iterate(), QVSubC_sFloatC1Block::iterate(), QVSubC_uCharC1Block::iterate(), QVSub_sFloatC3Block::iterate(), QVSub_sFloatC1Block::iterate(), QVSub_uCharC3Block::iterate(), QVSub_uCharC1Block::iterate(), QVMulScale_uCharC3Block::iterate(), QVMulScale_uCharC1Block::iterate(), QVMulC_sFloatC1Block::iterate(), QVMulC_uCharC1Block::iterate(), QVMul_sFloatC1Block::iterate(), QVMul_sFloatC3Block::iterate(), QVMul_uCharC3Block::iterate(), QVMul_uCharC1Block::iterate(), QVAddC_sFloatC1Block::iterate(), QVAddC_uCharC1Block::iterate(), QVAdd_sFloatC3Block::iterate(), QVAdd_sFloatC1Block::iterate(), QVAdd_uCharC3Block::iterate(), QVAdd_uCharC1Block::iterate(), QVConvert_sFloatuCharC3Block::iterate(), QVConvert_sFloatuCharC1Block::iterate(), QVConvert_uCharsFloatC3Block::iterate(), and QVConvert_uCharsFloatC1Block::iterate().
void QVProcessingBlock::pause | ( | ) | [inline, slot] |
Set block status to QVProcessingBlock::Paused.
Definition at line 221 of file qvprocessingblock.h.
void QVProcessingBlock::unPause | ( | ) | [inline, slot] |
Set block status to QVProcessingBlock::Running.
Definition at line 225 of file qvprocessingblock.h.
void QVProcessingBlock::step | ( | ) | [inline, slot] |
Set block status to QVProcessingBlock::RunningOneStep.
Definition at line 229 of file qvprocessingblock.h.
void QVProcessingBlock::stop | ( | ) | [inline, slot] |
Finish block execution.
Definition at line 233 of file qvprocessingblock.h.
void QVProcessingBlock::finish | ( | ) | [inline, slot] |
Finish block execution.
Definition at line 237 of file qvprocessingblock.h.
Referenced by QVApplication::quitItems().
virtual void QVProcessingBlock::processTrigger | ( | const QString | name | ) | [inline, virtual, slot] |
Process trigger activations in the block.
Triggers are just named actions that can be called upon a QVProcessingBlock to change it's state, initialize itself, or whatever action the programmer considers convenient, in a completely asynchronous manner.
When added to a block, they will depict a button in the corresponding property widget in the interface, that will do a call to QVProcessingBlock::processTrigger() function when pressed. Use addTrigger to add triggers to a block, and redefine this function to capture their activations.
name | the name of the trigger that was activated. |
Reimplemented in QVYUV4MPEG2WriterBlock.
Definition at line 253 of file qvprocessingblock.h.
void QVProcessingBlock::startIteration | ( | ) | [signal] |
Signal emited before each call to QVProcessingBlock::iterate() function.
void QVProcessingBlock::endIteration | ( | uint | id, | |
int | iteration | |||
) | [signal] |
Signal emited after each call to QVProcessingBlock::iterate() function.
void QVProcessingBlock::statusUpdate | ( | QVProcessingBlock::TBlockStatus | ) | [signal] |