Page MenuHomePhabricator

Dezentralize loading of state machine patterns
Closed, WontfixPublic

Description

Currently all state machine pattens are built up by loading the file statemachine.xml (or by loading a Qt resource).
When arraging the source code isolated from the core (external users etc.) a possibility to load additional state machine patterns is needed.

Event Timeline

adding core modification flag (sorry for spamming.....)

Hi Ingmar. I just corrected the "depends on/blocks", I think you meant it like this. The change is ok, extending the unit test is important, it's very basic at the moment.

should be done with care and not in a hurry. Furthermore intensive tests required. so feature request for future releases, not 1.0 in my opinion

adding dependency to external bug report / feature request

Advanced StateMachineFactoryTest to check loading of additional xml files. For this I will add two xml files to the testing/data directory and load them in StateMachineFactoryTest.

Conclusion after test:
Loading of additional xml-files works by using LoadBehavior(xmlfileName)!

I will write an EventMapperTest to also check loading of different event ID declarations and throw errors on parsing events that are already loaded (adding event ids, that are already present).

[SVN revision 26730]
ENH (#2820): change name of state machine pattern style from "Powerpoint" to "standard" and removing an unused and double declared event (id 1012, name PositionEvent)

[SVN revision 26741]
ENH (#2820): add and test support to specify additional xml files with state machine patterns and event declarations. See T2820 for further documentation.

[SVN revision 26752]
ENH (#2820): adding method to add manually created state machine patterns. Testing in StateMachineFactoryTest. Also correcting public StartElement and EndElement to protected in StateMachineFactory. See T2820 for further documentation.

Current state of EventMapepr:
static New() method, static EventDescriptionVector and static StateEvent instance that is passed to GlobalInteraction.
This makes it pretty static in my opinion!

Would a change from MITK_WARN to MITK_DEBUG message be suitable?

Then a refactoring of the loading within EventMapper and StateMachineFactory will include changes towards non static instances.

Sorry, I had not seen the static new().

Changing the MITK_WARN to MITK_DEBUG would certainly do the trick. The output will no longer occur in a normal environment but will be visible when needed for debugging.

Thanks

I spoke to Markus. An addition if statement will be added that avoids loading the same file again. So loading file A then file B and then file A again will not be caught and warnings will be displayed. Loading file A several times after another will not produce warnings.

[SVN revision 26817]
ENH (#2820): catching if the same file is to be parsed a second time. Test this in EventMapperTest. For further information see T2820.

[SVN revision 27350]
FIX (#2820): fixed mechanism to prevent from multiple loading the same xml statemachine behaviour.

Up to now, this mechanism used the FileName parameter of the vtkXmlParser parent. However, this is not static, whereas all the EventDescriptions are defined as static.

Thus, the FileName parameter always was reset to an empty string with a new instantiation of mitk::EventMapper.

[SVN revision 27351]
COMP (#2820): adapted test.

Trying to load the same xml file again must not return false, as this is no error.

If this returned false, we would get further fatal errors from global interaction etc.

Resetting all bugs without active assignee flag to "CONFIRMED". Change status to IN_PROGRESS if you are working on it.

@Christian: could you check the status of this please and comment or close?

This bug only concerns fuctionality which is covered by the reworked interaction concept. the issues seem only to be related to deprecated functions therefore closing this bug.

kislinsk added a project: Bulk Edit.
kislinsk removed a project: Bulk Edit.