Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::StateMachineState Class Reference

Represents a state of a state machine pattern. More...

#include <mitkStateMachineState.h>

Inheritance diagram for mitk::StateMachineState:
Collaboration diagram for mitk::StateMachineState:

Public Types

typedef std::vector< mitk::StateMachineState::Pointer > StateMap
 
typedef std::vector< StateMachineTransition::Pointer > TransitionVector
 

Public Member Functions

 mitkClassMacroItkParent (StateMachineState, itk::LightObject)
 
 mitkNewMacro2Param (Self, const std::string &, const std::string &)
 
bool AddTransition (StateMachineTransition::Pointer transition)
 Add a transition to this state. More...
 
TransitionVector GetTransitionList (const std::string &eventClass, const std::string &eventVariant)
 Return all transitions matching the given event description. More...
 
std::string GetName () const
 Return the name of this state. More...
 
std::string GetMode () const
 Return the mode of this state. More...
 
bool ConnectTransitions (StateMap *allStates)
 Connect all transitions to their target states by resolving state name references. More...
 

Protected Member Functions

 StateMachineState (const std::string &name, const std::string &stateMode)
 
 ~StateMachineState () override
 

Detailed Description

Represents a state of a state machine pattern.

It holds transitions to other states (mitk::StateMachineTransition) and the mode of the current state, which determines how the dispatcher handles events.

Definition at line 32 of file mitkStateMachineState.h.

Member Typedef Documentation

◆ StateMap

typedef std::vector<mitk::StateMachineState::Pointer> mitk::StateMachineState::StateMap

Definition at line 38 of file mitkStateMachineState.h.

◆ TransitionVector

typedef std::vector<StateMachineTransition::Pointer> mitk::StateMachineState::TransitionVector

Definition at line 39 of file mitkStateMachineState.h.

Constructor & Destructor Documentation

◆ StateMachineState()

mitk::StateMachineState::StateMachineState ( const std::string &  name,
const std::string &  stateMode 
)
protected

◆ ~StateMachineState()

mitk::StateMachineState::~StateMachineState ( )
overrideprotected

Member Function Documentation

◆ AddTransition()

bool mitk::StateMachineState::AddTransition ( StateMachineTransition::Pointer  transition)

Add a transition to this state.

Parameters
[in]transitionthe transition to add.
Returns
True if the transition was added, false if it already exists.

◆ ConnectTransitions()

bool mitk::StateMachineState::ConnectTransitions ( StateMap *  allStates)

Connect all transitions to their target states by resolving state name references.

Post-processing step when building a state machine from XML. Iterates all transitions and finds the State that matches each transition's target state name.

Parameters
[in]allStatesa list of all states in the state machine.
Returns
True if all transitions were connected successfully, false if any target state was not found.

◆ GetMode()

std::string mitk::StateMachineState::GetMode ( ) const

Return the mode of this state.

The mode can be "REGULAR", "GRAB_INPUT", or "PREFER_INPUT".

Returns
The state mode string.

◆ GetName()

std::string mitk::StateMachineState::GetName ( ) const

Return the name of this state.

Returns
The state name.

◆ GetTransitionList()

TransitionVector mitk::StateMachineState::GetTransitionList ( const std::string &  eventClass,
const std::string &  eventVariant 
)

Return all transitions matching the given event description.

Parameters
[in]eventClassthe event class to match.
[in]eventVariantthe event variant to match.
Returns
A vector of matching transitions.

◆ mitkClassMacroItkParent()

mitk::StateMachineState::mitkClassMacroItkParent ( StateMachineState  ,
itk::LightObject   
)

◆ mitkNewMacro2Param()

mitk::StateMachineState::mitkNewMacro2Param ( Self  ,
const std::string &  ,
const std::string &   
)

The documentation for this class was generated from the following file: