CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
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
25 class QObject;
26 class QState;
27 
28 // CTK includes
29 #include "ctkPimpl.h"
30 #include "ctkWorkflow_p.h"
31 #include "ctkWorkflowTransitions.h"
32 
33 #include "ctkCoreExport.h"
34 
35 class ctkWorkflow;
36 
37 class ctkWorkflowStepPrivate;
38 
44 
45 class CTK_CORE_EXPORT ctkWorkflowStep
46 {
47 
48 public:
49  explicit ctkWorkflowStep();
50  explicit ctkWorkflowStep(const QString& newId);
51  virtual ~ctkWorkflowStep();
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 
99 protected:
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 
243 protected:
244  QScopedPointer<ctkWorkflowStepPrivate> d_ptr;
245 
246 private:
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::onExitComplete
void onExitComplete() const
Signal (emitted by the private implementation) indicating that the step's 'onExit' processing has com...
ctkWorkflowStep::onEntry
virtual void onEntry(const ctkWorkflowStep *comingFrom, const ctkWorkflowInterstepTransition::InterstepTransitionType transitionType)
Reimplement this function for step-specific processing when entering a step.
ctkWorkflowStep
ctkWorkflowStep is the basis for a workflow step.
Definition: ctkWorkflowStep.h:46
ctkWorkflowStep::ctkWorkflowStep
ctkWorkflowStep()
ctkWorkflowStep::setId
void setId(const QString &newStepId)
ctkWorkflowStep::setHasOnEntryCommand
void setHasOnEntryCommand(bool newHasOnEntryCommand)
ctkWorkflowStep::d_ptr
QScopedPointer< ctkWorkflowStepPrivate > d_ptr
Definition: ctkWorkflowStep.h:244
ctkWorkflowStep::setHasOnExitCommand
void setHasOnExitCommand(bool newHasOnExitCommand)
ctkWorkflow
ctkWorkflow is the basis for a workflow engine, i.e. a state machine with enhancements to support ctk...
Definition: ctkWorkflow.h:40
ctkWorkflowStep::isWidgetType
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
ctkWorkflowStep::description
QString description() const
Set/get description.
ctkWorkflowStep::validationComplete
void validationComplete(bool validationSuceeded, const QString &branchId=QString()) const
Signal (emitted by the private implementation) indicating that validation of this step's processing h...
ctkWorkflowStep::ctkWorkflowStep
ctkWorkflowStep(const QString &newId)
ctkWorkflowStep::onExit
virtual void onExit(const ctkWorkflowStep *goingTo, const ctkWorkflowInterstepTransition::InterstepTransitionType transitionType)
Reimplement this function for step-specific processing when exiting a step.
ctkWorkflowTransitions.h
ctkWorkflowStep::hasOnEntryCommand
bool hasOnEntryCommand() const
ctkWorkflowStep::ctkWorkflowStepQObject
QObject * ctkWorkflowStepQObject()
Get QObject associated with this step, to connect signals/slots.
ctkWorkflowStep::hasValidateCommand
bool hasValidateCommand() const
ctkWorkflowStep::~ctkWorkflowStep
virtual ~ctkWorkflowStep()
ctkWorkflowStep::invokeOnExitCommand
void invokeOnExitCommand(const ctkWorkflowStep *goingTo, const ctkWorkflowInterstepTransition::InterstepTransitionType transitionType) const
Signal (emitted by the private implementation) indicating that the step's 'onExit' processing should ...
ctkWorkflowStep::processingState
QState * processingState() const
Get the step's processing state.
ctkWorkflowStep::setStatusText
void setStatusText(const QString &newText)
ctkWorkflowStep::name
QString name() const
Set/get name.
ctkWorkflowStep::validationTransition
ctkWorkflowIntrastepTransition * validationTransition() const
Get the step's validation transition.
ctkWorkflowStep::setHasValidateCommand
void setHasValidateCommand(bool newHasValidateCommand)
ctkWorkflowStep::validate
virtual void validate(const QString &desiredBranchId=QString())
Validates the computation performed in this step's processing state.
ctkWorkflowStep::invokeOnEntryCommand
void invokeOnEntryCommand(const ctkWorkflowStep *comingFrom, const ctkWorkflowInterstepTransition::InterstepTransitionType transitionType) const
Signal (emitted by the private implementation) indicating that the step's 'onEntry' processing should...
ctkWorkflowInterstepTransition::InterstepTransitionType
InterstepTransitionType
Definition: ctkWorkflowTransitions.h:140
ctkWorkflowStep::statusText
QString statusText() const
Get statusText.
ctkWorkflowStep::workflow
ctkWorkflow * workflow() const
Get the workflow associated with this step.
ctkWorkflowStep::validationFailedTransition
ctkWorkflowIntrastepTransition * validationFailedTransition() const
Get the step's validation failed transition.
ctkWorkflowStep::ctkWorkflowStep
ctkWorkflowStep(ctkWorkflowStepPrivate *pimpl, const QString &newId)
ctkWorkflowIntrastepTransition
Definition: ctkWorkflowTransitions.h:66
ctkPimpl.h
ctkWorkflowStep::setDescription
void setDescription(const QString &newDescription)
ctkWorkflowStep::validationState
QState * validationState() const
Get the step's validation state.
ctkWorkflowStep::onEntryComplete
void onEntryComplete() const
Signal (emitted by the private implementation) indicating that the step's 'onEntry' processing has co...
ctkWorkflowStep::id
QString id() const
Get id.
ctkWorkflowStep::setWorkflow
void setWorkflow(ctkWorkflow *newWorkflow)
Set workflow.
ctkWorkflowStep::hasOnExitCommand
bool hasOnExitCommand() const
ctkWorkflowStep::invokeValidateCommand
void invokeValidateCommand(const QString &desiredBranchId=QString()) const
Signal (emitted by the private implementation) indicating that validation of this step's processing s...
ctkWorkflowStep::setName
void setName(const QString &newName)