/
ctkExampleDerivedWorkflowStep.cpp
104 lines (81 loc) · 3.54 KB
/
ctkExampleDerivedWorkflowStep.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*=========================================================================
Library: CTK
Copyright (c) 2010 Kitware Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.commontk.org/LICENSE
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
// CTK includes
#include "ctkExampleDerivedWorkflowStep.h"
//-----------------------------------------------------------------------------
class ctkExampleDerivedWorkflowStepPrivate
{
public:
ctkExampleDerivedWorkflowStepPrivate();
// counters of the number of times we have run the onEntry()
// and onExit() functions
int numberOfTimesRanOnEntry;
int numberOfTimesRanOnExit;
};
//-----------------------------------------------------------------------------
// ctkExampleDerivedWorkflowStepPrivate methods
//-----------------------------------------------------------------------------
ctkExampleDerivedWorkflowStepPrivate::ctkExampleDerivedWorkflowStepPrivate()
{
this->numberOfTimesRanOnEntry = 0;
this->numberOfTimesRanOnExit = 0;
}
//-----------------------------------------------------------------------------
// ctkExampleDerivedWorkflowStep methods
//-----------------------------------------------------------------------------
ctkExampleDerivedWorkflowStep::ctkExampleDerivedWorkflowStep(ctkWorkflow* newWorkflow, const QString& newId) :
Superclass(newWorkflow, newId)
, d_ptr(new ctkExampleDerivedWorkflowStepPrivate)
{
}
//-----------------------------------------------------------------------------
ctkExampleDerivedWorkflowStep::~ctkExampleDerivedWorkflowStep()
{
}
//-----------------------------------------------------------------------------
void ctkExampleDerivedWorkflowStep::validate(const QString& desiredBranchId)
{
// Always returns true in this simple example
this->validationComplete(true,desiredBranchId);
}
//-----------------------------------------------------------------------------
void ctkExampleDerivedWorkflowStep::onEntry(
const ctkWorkflowStep* comingFrom,
const ctkWorkflowInterstepTransition::InterstepTransitionType transitionType)
{
Q_UNUSED(comingFrom);
Q_UNUSED(transitionType);
// Simply implements our counter of the number of times we have run this function
Q_D(ctkExampleDerivedWorkflowStep);
d->numberOfTimesRanOnEntry++;
// signals that we are finished
this->onEntryComplete();
}
//-----------------------------------------------------------------------------
void ctkExampleDerivedWorkflowStep::onExit(
const ctkWorkflowStep* goingTo,
const ctkWorkflowInterstepTransition::InterstepTransitionType transitionType)
{
Q_UNUSED(goingTo);
Q_UNUSED(transitionType);
// simply implements our counter of the number of times we have run
// this function
Q_D(ctkExampleDerivedWorkflowStep);
d->numberOfTimesRanOnExit++;
// signals that we are finished
this->onExitComplete();
}
//-----------------------------------------------------------------------------
CTK_GET_CXX(ctkExampleDerivedWorkflowStep, int, numberOfTimesRanOnEntry, numberOfTimesRanOnEntry);
CTK_GET_CXX(ctkExampleDerivedWorkflowStep, int, numberOfTimesRanOnExit, numberOfTimesRanOnExit);