MCPcopy Create free account
hub / github.com/MITK/MITK / HandleEvent

Method HandleEvent

Modules/Core/src/Interactions/mitkEventStateMachine.cpp:97–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97bool mitk::EventStateMachine::HandleEvent(InteractionEvent *event, DataNode *dataNode)
98{
99 if (!m_IsActive)
100 return false;
101
102 if (!FilterEvents(event, dataNode))
103 {
104 return false;
105 }
106
107 // Get the transition that can be executed
108 mitk::StateMachineTransition::Pointer transition = GetExecutableTransition(event);
109
110 // check if the current state holds a transition that works with the given event.
111 if (transition.IsNotNull())
112 {
113 // all conditions are fulfilled so we can continue with the actions
114 m_CurrentState = transition->GetNextState();
115
116 // iterate over all actions in this transition and execute them
117 const ActionVectorType actions = transition->GetActions();
118 for (auto it = actions.cbegin(); it != actions.cend(); ++it)
119 {
120 try
121 {
122 ExecuteAction(*it, event);
123 }
124 catch (const std::exception &e)
125 {
126 MITK_ERROR << "Unhandled exception caught in ExecuteAction(): " << e.what();
127 return false;
128 }
129 catch (...)
130 {
131 MITK_ERROR << "Unhandled exception caught in ExecuteAction()";
132 return false;
133 }
134 }
135
136 return true;
137 }
138 return false;
139}
140
141void mitk::EventStateMachine::ConnectActionsAndFunctions()
142{

Callers 1

ProcessEventMethod · 0.45

Calls 4

IsNotNullMethod · 0.80
GetNextStateMethod · 0.80
whatMethod · 0.80
GetActionsMethod · 0.45

Tested by

no test coverage detected