Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
mitkStateMachineContainer.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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkStateMachineContainer_h
14 #define mitkStateMachineContainer_h
15 
16 #include "itkObject.h"
17 #include <iostream>
18 #include <vtkXMLParser.h>
19 
20 #include "itkObjectFactory.h"
21 #include "mitkCommon.h"
22 
23 #include "mitkStateMachineAction.h"
24 #include "mitkStateMachineState.h"
26 
27 namespace us
28 {
29  class Module;
30 }
31 
32 namespace mitk
33 {
39  class StateMachineContainer : public vtkXMLParser
40  {
41  public:
42  static StateMachineContainer *New();
43  vtkTypeMacro(StateMachineContainer, vtkXMLParser);
44 
48  typedef std::vector<StateMachineState::Pointer> StateMachineCollectionType;
49 
54 
61  bool LoadBehavior(const std::string &fileName, const us::Module *module);
62 
67 
68  protected:
70  ~StateMachineContainer() override;
71 
75  void StartElement(const char *elementName, const char **atts) override;
79  void EndElement(const char *elementName) override;
80 
81  private:
85  std::string ReadXMLStringAttribut(std::string name, const char **atts);
89  bool ReadXMLBooleanAttribut(std::string name, const char **atts);
90 
94  void ConnectStates();
95 
96  StateMachineState::Pointer m_StartState;
97  StateMachineState::Pointer m_CurrState;
98  StateMachineTransition::Pointer m_CurrTransition;
99 
101  bool m_StartStateFound;
102  bool
103  m_errors; // use member, because of inheritance from vtkXMLParser we can't return a success value for parsing the
104  // file.
105  std::string m_Filename; // store file name for debug purposes.
106  };
107 
108 } // namespace mitk
109 
110 #endif
mitk::StateMachineContainer::vtkTypeMacro
vtkTypeMacro(StateMachineContainer, vtkXMLParser)
mitkStateMachineState.h
mitk::StateMachineContainer::StateMachineContainer
StateMachineContainer()
mitk::StateMachineContainer::StartElement
void StartElement(const char *elementName, const char **atts) override
Derived from XMLReader.
mitkStateMachineAction.h
mitk::StateMachineContainer::LoadBehavior
bool LoadBehavior(const std::string &fileName, const us::Module *module)
Loads XML resource.
mitk::StateMachineContainer::~StateMachineContainer
~StateMachineContainer() override
us
Definition: mitkAbstractFileReader.h:29
mitk::StateMachineContainer::EndElement
void EndElement(const char *elementName) override
Derived from XMLReader.
itk::SmartPointer< Self >
mitkStateMachineTransition.h
mitk::StateMachineContainer::GetStartState
StateMachineState::Pointer GetStartState() const
Returns the StartState of the StateMachine.
mitk::StateMachineContainer
Definition: mitkStateMachineContainer.h:39
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::StateMachineContainer::New
static StateMachineContainer * New()
us::Module
Definition: usModule.h:78
mitkCommon.h
mitk::StateMachineContainer::InteractionStateMachine
friend class InteractionStateMachine
Definition: mitkStateMachineContainer.h:66
mitk::StateMachineContainer::StateMachineCollectionType
std::vector< StateMachineState::Pointer > StateMachineCollectionType
This type holds all states of one statemachine.
Definition: mitkStateMachineContainer.h:48