ctkWorkflow is the basis for a workflow engine, i.e. a state machine with enhancements to support ctkWorkflowStep.
More...
#include <Libs/Core/ctkWorkflow.h>
|
virtual void | evaluateValidationResults (bool validationSucceeded, const QString &branchId) |
| Receives the result of a step's validate(const QString&) function. More...
|
|
virtual void | goBackward (const QString &desiredBranchId=QString()) |
| Use this to trigger transition to the previous step (does not require validation) More...
|
|
virtual void | goForward (const QString &desiredBranchId=QString()) |
|
virtual void | goToStep (const QString &targetId) |
| Go to the given step by iteratively calling goForward() until we reach it. More...
|
|
|
virtual Q_INVOKABLE bool | addTransition (ctkWorkflowStep *origin, ctkWorkflowStep *destination, const QString &branchId=QString(), const ctkWorkflow::TransitionDirectionality directionality=ctkWorkflow::Bidirectional) |
| Creates a transition between two steps, and adds the two steps to the workflow if they have not been previously added. (Cannot add two steps with the same id). More...
|
|
Q_INVOKABLE int | backwardDistanceToStep (ctkWorkflowStep *fromStep=0, ctkWorkflowStep *origin=0) const |
|
Q_INVOKABLE QList< ctkWorkflowStep * > | backwardSteps (ctkWorkflowStep *step=0) const |
|
Q_INVOKABLE bool | canGoBackward (ctkWorkflowStep *step=0) const |
|
Q_INVOKABLE bool | canGoForward (ctkWorkflowStep *step=0) const |
|
Q_INVOKABLE bool | canGoToStep (const QString &targetId, ctkWorkflowStep *step=0) const |
|
| ctkWorkflow (QObject *parent=0) |
|
Q_INVOKABLE ctkWorkflowStep * | currentStep () const |
|
Q_INVOKABLE QList< ctkWorkflowStep * > | finishSteps () const |
| Get the steps that are 'finish' steps (i.e. have no step following them) More...
|
|
Q_INVOKABLE QList< ctkWorkflowStep * > | forwardSteps (ctkWorkflowStep *step=0) const |
|
bool | goBackToOriginStepUponSuccess () const |
|
Q_INVOKABLE bool | hasStep (const QString &id) const |
|
Q_INVOKABLE bool | hasTransition (ctkWorkflowStep *origin, ctkWorkflowStep *destination, const QString &branchId=QString(), const ctkWorkflow::TransitionDirectionality directionality=ctkWorkflow::Bidirectional) |
| Determine whether a transition has already been added. More...
|
|
Q_INVOKABLE ctkWorkflowStep * | initialStep () const |
| Set/get the initial step. More...
|
|
bool | isRunning () const |
| Returns whether the workflow is currently running. More...
|
|
void | setGoBackToOriginStepUponSuccess (bool flag) |
|
virtual Q_INVOKABLE void | setInitialStep (ctkWorkflowStep *step) |
|
void | setVerbose (bool value) |
|
virtual Q_INVOKABLE void | start () |
| Start the workflow. The workflow will always start in the initial step, even if it is stopped and restarted). More...
|
|
Q_INVOKABLE ctkWorkflowStep * | step (const QString &id) const |
|
Q_INVOKABLE QList< ctkWorkflowStep * > | steps () const |
| Returns list of steps managed by the workflow. More...
|
|
virtual Q_INVOKABLE void | stop () |
| Stops the workflow. More...
|
|
bool | verbose () const |
| If set debug messages will be displayed on standard output. More...
|
|
virtual | ~ctkWorkflow () |
|
|
void | attemptToGoToNextStep () |
|
void | performTransitionBetweenSteps () |
| Called when transitioning to the next step upon successful validation, or when transitioning to the previous step. Calls onExit() of the transition's origin step and then onEntry() of the transition's destination step. More...
|
|
|
QScopedPointer< ctkWorkflowPrivate > | d_ptr |
|
ctkWorkflow is the basis for a workflow engine, i.e. a state machine with enhancements to support ctkWorkflowStep.
Definition at line 39 of file ctkWorkflow.h.
◆ Superclass
◆ TransitionDirectionality
Transition directionalities.
The direction of transitions between an origin step and a destination step can be either:
-
Bidirectional: A transition from the origin to the destination, and a transition from the destination to the origin
-
Forward: A transition from the origin to the destination only
-
Backward: A transition from the destination to the origin only
Enumerator |
---|
Bidirectional | |
Forward | |
Backward | |
Definition at line 74 of file ctkWorkflow.h.
◆ ctkWorkflow()
ctkWorkflow::ctkWorkflow |
( |
QObject * |
parent = 0 | ) |
|
|
explicit |
◆ ~ctkWorkflow()
virtual ctkWorkflow::~ctkWorkflow |
( |
| ) |
|
|
virtual |
◆ addTransition()
Creates a transition between two steps, and adds the two steps to the workflow if they have not been previously added. (Cannot add two steps with the same id).
The destination step should semantically be a next step, i.e. from a workflow perspective, the destination step is meant to appear after the origin step.
To add a single step, destination can be set to 0.
Returns true/false indicating whether the method was successful.
◆ attemptToGoToNextStep
void ctkWorkflow::attemptToGoToNextStep |
( |
| ) |
|
|
protectedslot |
On an attempt to go to the next step, calls the current step's validate(const QString&) function to validate the processing step.
◆ backwardDistanceToStep()
◆ backwardSteps()
Get the steps that directly preceed the given step.
More specifically, the returned list of steps will be the origin steps for which addTransition() has been called with the given step as the destination step and directionality set to ctkWorkflow::Bidirectional or ctkWorkflow::Backward.
If no step is given, then the workflow's current step will be used.
◆ canGoBackward()
Q_INVOKABLE bool ctkWorkflow::canGoBackward |
( |
ctkWorkflowStep * |
step = 0 | ) |
const |
Returns whether or not we can go backward: i.e. there exists a step that directly preceeds the given step.
If no step is given, then the workflow's current step will be used.
◆ canGoForward()
Q_INVOKABLE bool ctkWorkflow::canGoForward |
( |
ctkWorkflowStep * |
step = 0 | ) |
const |
Returns whether or not we can go forward: i.e. there exists a step that directly follows the given step.
If no step is given, then the workflow's current step will be used.
◆ canGoToStep()
Q_INVOKABLE bool ctkWorkflow::canGoToStep |
( |
const QString & |
targetId, |
|
|
ctkWorkflowStep * |
step = 0 |
|
) |
| const |
Returns whether or not we can go to the goal step from the origin step: i.e. there is a path in the workflow from the current step to the given step.
If no step is designated as the 'origin', then the workflow's current step will be used Note: does not currently work in branching workflows if the origin and target steps are not on the same branch
◆ currentStep()
◆ currentStepChanged
Emitted when the current step has changed, after the step's onEntry() has completed.
- Note
- This signal is not emitted in the process of going to a goToStep
◆ evaluateValidationResults
virtual void ctkWorkflow::evaluateValidationResults |
( |
bool |
validationSucceeded, |
|
|
const QString & |
branchId |
|
) |
| |
|
virtualslot |
Receives the result of a step's validate(const QString&) function.
If the validation is successful, then this slot begins the transition to the next step.
◆ finishSteps()
Get the steps that are 'finish' steps (i.e. have no step following them)
◆ forwardSteps()
Get the steps that directly follow the given step.
More specifically, the returned list of steps will be the destination steps for which addTransition() has been called with the given step as the origin step and directionality set to ctkWorkflow::Bidirectional or ctkWorkflow::Forward.
If no step is given, then the workflow's current step will be used.
◆ goBackToOriginStepUponSuccess()
bool ctkWorkflow::goBackToOriginStepUponSuccess |
( |
| ) |
const |
Configures the behavior of goToStep(targetId).
If set to true, goToStep(targetId) goes back to the origin step after the attempt of going to the target step succeeded. If set to false, goToStep(targetId) stays at the target step when the attempt succeeded.
◆ goBackward
virtual void ctkWorkflow::goBackward |
( |
const QString & |
desiredBranchId = QString() | ) |
|
|
virtualslot |
Use this to trigger transition to the previous step (does not require validation)
◆ goForward
virtual void ctkWorkflow::goForward |
( |
const QString & |
desiredBranchId = QString() | ) |
|
|
virtualslot |
Use this to trigger evaluation of the processing state of the current step, and subsequent conditional transition to the next step.
◆ goFromGoToStepToStartingStep()
void ctkWorkflow::goFromGoToStepToStartingStep |
( |
| ) |
|
|
protected |
Goes to the step from which the attempt to go to the 'goTo' step was initiated.
◆ goToNextStepAfterSuccessfulValidation()
void ctkWorkflow::goToNextStepAfterSuccessfulValidation |
( |
const QString & |
branchId | ) |
|
|
protected |
◆ goToProcessingStateAfterValidationFailed()
void ctkWorkflow::goToProcessingStateAfterValidationFailed |
( |
| ) |
|
|
protected |
◆ goToStep
virtual void ctkWorkflow::goToStep |
( |
const QString & |
targetId | ) |
|
|
virtualslot |
Go to the given step by iteratively calling goForward() until we reach it.
◆ goToStepFailed()
virtual void ctkWorkflow::goToStepFailed |
( |
| ) |
|
|
protectedvirtual |
Processing that occurs after the attempt to go to a 'goTo' step fails.
◆ goToStepSucceeded()
virtual void ctkWorkflow::goToStepSucceeded |
( |
| ) |
|
|
protectedvirtual |
Processing that occurs after the attempt to go to a 'goTo' step succeeds.
◆ hasStep()
Q_INVOKABLE bool ctkWorkflow::hasStep |
( |
const QString & |
id | ) |
const |
◆ hasTransition()
Determine whether a transition has already been added.
-
If a branch id is not given or is empty: a transition exists if a transition has been previously added with the same origin, destination and directionality
-
If a non-empty branch id is given: a transition exists if the transition has been previously added with the same origin, destination and directionality, OR if a transition has been previously added with the same origin and branch id (for forward transitions) or with the same destination and branch id (for backward transitions)
◆ initialStep()
◆ isRunning()
bool ctkWorkflow::isRunning |
( |
| ) |
const |
Returns whether the workflow is currently running.
◆ performTransitionBetweenSteps
void ctkWorkflow::performTransitionBetweenSteps |
( |
| ) |
|
|
protectedslot |
Called when transitioning to the next step upon successful validation, or when transitioning to the previous step. Calls onExit() of the transition's origin step and then onEntry() of the transition's destination step.
- Note
- Must be sent by a ctkWorkflowTransition.
◆ setGoBackToOriginStepUponSuccess()
void ctkWorkflow::setGoBackToOriginStepUponSuccess |
( |
bool |
flag | ) |
|
◆ setInitialStep()
virtual Q_INVOKABLE void ctkWorkflow::setInitialStep |
( |
ctkWorkflowStep * |
step | ) |
|
|
virtual |
◆ setVerbose()
void ctkWorkflow::setVerbose |
( |
bool |
value | ) |
|
◆ start()
virtual Q_INVOKABLE void ctkWorkflow::start |
( |
| ) |
|
|
virtual |
Start the workflow. The workflow will always start in the initial step, even if it is stopped and restarted).
- Note
- Calls onEntry() for the initial step.
◆ step()
◆ stepRegistered
Emitted when a step is registered with this workflow
- See also
- addTransition
◆ steps()
Returns list of steps managed by the workflow.
◆ stop()
virtual Q_INVOKABLE void ctkWorkflow::stop |
( |
| ) |
|
|
virtual |
Stops the workflow.
- Note
- Calls onExit() for the current step.
◆ verbose()
bool ctkWorkflow::verbose |
( |
| ) |
const |
If set debug messages will be displayed on standard output.
◆ d_ptr
QScopedPointer<ctkWorkflowPrivate> ctkWorkflow::d_ptr |
|
protected |
◆ goBackToOriginStepUponSuccess
bool ctkWorkflow::goBackToOriginStepUponSuccess |
|
readwrite |
◆ isRunning
bool ctkWorkflow::isRunning |
|
read |
◆ verbose
bool ctkWorkflow::verbose |
|
readwrite |
The documentation for this class was generated from the following file: