Medical Imaging Interaction Toolkit  2016.11.0
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,
6  Division of Medical and Biological Informatics.
7  All rights reserved.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without
10  even the implied warranty of MERCHANTABILITY or FITNESS FOR
11  A PARTICULAR PURPOSE.
12 
13  See LICENSE.txt or http://www.mitk.org for details.
14 
15  ===================================================================*/
16 
17 #ifndef SMTRANSITION_H_HEADER_INCLUDED
18 #define SMTRANSITION_H_HEADER_INCLUDED
19 
20 #include "mitkCommon.h"
21 #include "mitkInteractionEvent.h"
22 #include "mitkStateMachineAction.h"
24 #include <itkLightObject.h>
25 #include <string>
26 
27 #include "MitkCoreExports.h"
28 
29 namespace mitk
30 {
32 
33  typedef std::vector<mitk::StateMachineAction::Pointer> ActionVectorType;
34  typedef std::vector<StateMachineCondition> ConditionVectorType;
36 
48  class MITKCORE_EXPORT StateMachineTransition : public itk::LightObject
49  {
50  friend class StateMachineFactory;
51  friend class StateMachineContainer;
52 
53  public:
55  mitkNewMacro3Param(Self, const std::string &, const std::string &, const std::string &);
56 
57  SpStateMachineState GetNextState() const;
58  std::string GetNextStateName() const;
64  bool operator==(const StateMachineTransition &transition) const;
65 
69  ActionVectorType GetActions() const;
70 
71  const ConditionVectorType &GetConditions() const;
72 
76  void SetNextState(const SpStateMachineState &nextState);
77 
78  protected:
79  StateMachineTransition(const std::string &nextStateName,
80  const std::string &eventClass,
81  const std::string &eventVariant);
82  virtual ~StateMachineTransition();
83 
84  // Triggering Event
85  std::string m_EventClass;
86  std::string m_EventVariant;
87 
88  private:
89  void AddAction(const StateMachineAction::Pointer &action);
90 
91  void AddCondition(const StateMachineCondition &condition);
92 
93  SpStateMachineState m_NextState;
94 
95  std::string m_NextStateName;
96 
97  InteractionEvent::Pointer m_TransitionEvent;
98 
102  std::vector<StateMachineAction::Pointer> m_Actions;
103 
104  ConditionVectorType m_Conditions;
105  };
106 
107 } // namespace mitk
108 
109 #endif /* SMTRANSITION_H_HEADER_INCLUDED */
#define MITKCORE_EXPORT
itk::SmartPointer< StateMachineState > SpStateMachineState
std::vector< mitk::StateMachineAction::Pointer > ActionVectorType
DataCollection - Class to facilitate loading/accessing structured data.
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:53
Connects two states, and holds references to corresponding actions and conditions.
#define mitkNewMacro3Param(classname, typea, typeb, typec)
Definition: mitkCommon.h:102
Represents a condition, that has to be fulfilled in order to execute a state machine transition after...
std::vector< StateMachineCondition > ConditionVectorType