CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Loading...
Searching...
No Matches
ctkWorkflowStep.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Library: CTK
4
5 Copyright (c) Kitware Inc.
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0.txt
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18
19=========================================================================*/
20
21#ifndef __ctkWorkflowStep_h
22#define __ctkWorkflowStep_h
23
24// Qt includes
25class QObject;
26class QState;
27
28// CTK includes
29#include "ctkPimpl.h"
30#include "ctkWorkflow_p.h"
32
33#include "ctkCoreExport.h"
34
35class ctkWorkflow;
36
37class ctkWorkflowStepPrivate;
38
44
45class CTK_CORE_EXPORT ctkWorkflowStep
46{
47
48public:
49 explicit ctkWorkflowStep();
50 explicit ctkWorkflowStep(const QString& newId);
52
55
57 QString id()const;
58
61 void setId(const QString& newStepId);
62
64 QString name()const;
65 void setName(const QString& newName);
66
68 QString description()const;
69 void setDescription(const QString& newDescription);
70
72 QString statusText()const;
73
77 bool hasValidateCommand()const;
78 void setHasValidateCommand(bool newHasValidateCommand);
79
83 bool hasOnEntryCommand()const;
84 void setHasOnEntryCommand(bool newHasOnEntryCommand);
85
90 bool hasOnExitCommand()const;
91 void setHasOnExitCommand(bool newHasOnExitCommand);
92
94 bool isWidgetType()const;
95
98
99protected:
100
101 explicit ctkWorkflowStep(ctkWorkflowStepPrivate * pimpl, const QString& newId);
102
104 void setWorkflow(ctkWorkflow* newWorkflow);
105
106 void setStatusText(const QString& newText);
107
111 QState* processingState()const;
112
116 QState* validationState()const;
117
131
148
162 virtual void onEntry(const ctkWorkflowStep* comingFrom, const ctkWorkflowInterstepTransition::InterstepTransitionType transitionType);
163
177 virtual void onExit(const ctkWorkflowStep* goingTo,
179
190 //
205 virtual void validate(const QString& desiredBranchId = QString());
206
211 void invokeValidateCommand(const QString& desiredBranchId = QString())const;
212
217 void validationComplete(bool validationSuceeded, const QString& branchId = QString())const;
218
224
229 void onEntryComplete()const;
230
236
241 void onExitComplete()const;
242
243protected:
244 QScopedPointer<ctkWorkflowStepPrivate> d_ptr;
245
246private:
247 Q_DECLARE_PRIVATE(ctkWorkflowStep);
248 Q_DISABLE_COPY(ctkWorkflowStep);
249 friend class ctkWorkflow; // For access to processingState, validationState, setWorkflow, validate
250 friend class ctkWorkflowPrivate; // For access to invokeOn{Entry,Exit}Command, on{Entry,Exit}
251};
252
253#endif
ctkWorkflowStep is the basis for a workflow step.
void invokeValidateCommand(const QString &desiredBranchId=QString()) const
Signal (emitted by the private implementation) indicating that validation of this step's processing s...
QString statusText() const
Get statusText.
QString description() const
Set/get description.
QState * processingState() const
Get the step's processing state.
ctkWorkflowIntrastepTransition * validationTransition() const
Get the step's validation transition.
bool hasValidateCommand() const
void validationComplete(bool validationSuceeded, const QString &branchId=QString()) const
Signal (emitted by the private implementation) indicating that validation of this step's processing h...
QState * validationState() const
Get the step's validation state.
virtual void onExit(const ctkWorkflowStep *goingTo, const ctkWorkflowInterstepTransition::InterstepTransitionType transitionType)
Reimplement this function for step-specific processing when exiting a step.
void setWorkflow(ctkWorkflow *newWorkflow)
Set workflow.
bool hasOnExitCommand() const
void setHasOnEntryCommand(bool newHasOnEntryCommand)
void onExitComplete() const
Signal (emitted by the private implementation) indicating that the step's 'onExit' processing has com...
void setName(const QString &newName)
void setId(const QString &newStepId)
ctkWorkflowIntrastepTransition * validationFailedTransition() const
Get the step's validation failed transition.
ctkWorkflowStep(ctkWorkflowStepPrivate *pimpl, const QString &newId)
ctkWorkflow * workflow() const
Get the workflow associated with this step.
virtual void validate(const QString &desiredBranchId=QString())
Validates the computation performed in this step's processing state.
void invokeOnExitCommand(const ctkWorkflowStep *goingTo, const ctkWorkflowInterstepTransition::InterstepTransitionType transitionType) const
Signal (emitted by the private implementation) indicating that the step's 'onExit' processing should ...
QObject * ctkWorkflowStepQObject()
Get QObject associated with this step, to connect signals/slots.
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
void setHasOnExitCommand(bool newHasOnExitCommand)
void invokeOnEntryCommand(const ctkWorkflowStep *comingFrom, const ctkWorkflowInterstepTransition::InterstepTransitionType transitionType) const
Signal (emitted by the private implementation) indicating that the step's 'onEntry' processing should...
QString id() const
Get id.
void onEntryComplete() const
Signal (emitted by the private implementation) indicating that the step's 'onEntry' processing has co...
QString name() const
Set/get name.
QScopedPointer< ctkWorkflowStepPrivate > d_ptr
virtual void onEntry(const ctkWorkflowStep *comingFrom, const ctkWorkflowInterstepTransition::InterstepTransitionType transitionType)
Reimplement this function for step-specific processing when entering a step.
virtual ~ctkWorkflowStep()
void setHasValidateCommand(bool newHasValidateCommand)
ctkWorkflowStep(const QString &newId)
void setDescription(const QString &newDescription)
bool hasOnEntryCommand() const
void setStatusText(const QString &newText)
ctkWorkflow is the basis for a workflow engine, i.e. a state machine with enhancements to support ctk...
Definition: ctkWorkflow.h:40