Page MenuHomePhabricator

Add Warnings on StateMachine failures
Closed, ResolvedPublic

Description

Warnings need to be thrown on failures of StateMachine classes.

Especially for initialization of StateMachine an error has to be shown, e.g. StartState could not be set because no StateMachinePattern-Name was defined via constructor.

Event Timeline

  • Restructuring GlonalInteractionTest to also check non singleton

instanciation.

  • adding MITK_FATAL Messages in GlobalInteraction and StateMachine
  • within initialization of GlobalInteraction: returning false if no startState

recieved by StateMachineFactory. Then it is not initialized (former bug).

  • changing itkWarningMacro to MITK_FATAL or MITK_WARN to use same output

strategy

  • restucturing of GlobalInteractionTest and using test macros

[SVN revision 24241]
FIX (#4527): adding string for statemachine pattern in mitkSliceNavigationController instantiation. A pattern name should always be given otherwise the statemachine cannot be initialized.

[SVN revision 24242]
FIX (#4527): adding MITK_FATAL and Error messages in case a statemachine could not be connected to its corresponding statemachine-pattern; restructuring tests for this;

[SVN revision 24244]
COMP (#4527): fatal message causes a test to fail? Adding outputs for now

[SVN revision 24262]
COMP (#4527): due to vtkDebugLeaks and static StateMachineFactory and EventMapper, temporarily disabling StateMachineTest

Analysis of the failed StateMachineTest shows that both EventMapper and StateMachineFactory are instanciated during mitk::GlobalInteraction::Initialize(...) as often as the method is called!
I changed it to delete the previous instance of StateMachineFactory and EventMapper. They are not reused to clear the list of statemachine patterns and event descriptions and not to add the information. The bug didn't show up before, because mitk::GLobalInteraction::Initialize(...) is only called once. In StateMachineFactoryTest I call it several times.

Wonderfull example of why VTKDebugLeaks are nice!

[SVN revision 24372]
FIX (#4527): enabling mitkStateMachineTest again and adding one test case. Tests showed a bug in GlobalInteraction where StateMachineFactory and EventMapper was instantiated each time initialize is called. Adding safety clear in destructor of StateMachineFactory.

tests show green. so closing bug

Reopening to add define macros explicitly for statemachine logging. feature, that makes debugging of statemachine more easy.

Defining Statemachine Log Macros (STATEMACHINE_INFO and so on) to be able to debug the behaviour of the statemachine more easy.
Switching to the use of these for described error and warnings handling.
Also removing still present itkWarningMacros. Adding STATEMACHINE_DEBUG message for viewing statechange of statemachine if MBILOG_ENABLE_DEBUG_MESSAGES is set to on.

[SVN revision 25739]
ENH (#4527): Changing to special defined log macros (STATEMACHINE_WARN etc.) and adding debug log macro on StateChange