Medical Imaging Interaction Toolkit  2021.10.99-9c07a326
Medical Imaging Interaction Toolkit
mitkStateMachineTransition.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef SMTRANSITION_H_HEADER_INCLUDED
14 #define SMTRANSITION_H_HEADER_INCLUDED
15 
16 #include "mitkCommon.h"
17 #include "mitkInteractionEvent.h"
18 #include "mitkStateMachineAction.h"
20 #include <itkLightObject.h>
21 #include <string>
22 
23 #include "MitkCoreExports.h"
24 
25 namespace mitk
26 {
28 
29  typedef std::vector<mitk::StateMachineAction::Pointer> ActionVectorType;
30  typedef std::vector<StateMachineCondition> ConditionVectorType;
32 
44  class MITKCORE_EXPORT StateMachineTransition : public itk::LightObject
45  {
46  friend class StateMachineFactory;
47  friend class StateMachineContainer;
48 
49  public:
51  mitkNewMacro3Param(Self, const std::string &, const std::string &, const std::string &);
52 
53  SpStateMachineState GetNextState() const;
54  std::string GetNextStateName() const;
60  bool operator==(const StateMachineTransition &transition) const;
61 
65  ActionVectorType GetActions() const;
66 
67  const ConditionVectorType &GetConditions() const;
68 
72  void SetNextState(const SpStateMachineState &nextState);
73 
74  protected:
75  StateMachineTransition(const std::string &nextStateName,
76  const std::string &eventClass,
77  const std::string &eventVariant);
78  ~StateMachineTransition() override;
79 
80  // Triggering Event
81  std::string m_EventClass;
82  std::string m_EventVariant;
83 
84  private:
85  void AddAction(const StateMachineAction::Pointer &action);
86 
87  void AddCondition(const StateMachineCondition &condition);
88 
89  SpStateMachineState m_NextState;
90 
91  std::string m_NextStateName;
92 
93  InteractionEvent::Pointer m_TransitionEvent;
94 
98  std::vector<StateMachineAction::Pointer> m_Actions;
99 
100  ConditionVectorType m_Conditions;
101  };
102 
103 } // namespace mitk
104 
105 #endif /* SMTRANSITION_H_HEADER_INCLUDED */
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
#define MITKCORE_EXPORT
itk::SmartPointer< StateMachineState > SpStateMachineState
std::vector< mitk::StateMachineAction::Pointer > ActionVectorType
DataCollection - Class to facilitate loading/accessing structured data.
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
Connects two states, and holds references to corresponding actions and conditions.
#define mitkNewMacro3Param(classname, typea, typeb, typec)
Definition: mitkCommon.h:94
Represents a condition, that has to be fulfilled in order to execute a state machine transition after...
std::vector< StateMachineCondition > ConditionVectorType