Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkNonBlockingAlgorithmEvents.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 mitkNonBlockingAlgorithmEvents_h
14 #define mitkNonBlockingAlgorithmEvents_h
15 
16 #include <itkEventObject.h>
17 
18 namespace mitk
19 {
20  class NonBlockingAlgorithm;
21 
32  class NonBlockingAlgorithmEvent : public itk::AnyEvent
33  {
34  public:
36  typedef itk::AnyEvent Superclass;
37 
42  NonBlockingAlgorithmEvent(const NonBlockingAlgorithm *algorithm = nullptr) : m_Algorithm(algorithm) {}
44 
46  const char *GetEventName() const override { return "NonBlockingAlgorithmEvent"; }
47 
53  bool CheckEvent(const ::itk::EventObject *e) const override { return dynamic_cast<const Self *>(e); }
54 
59  ::itk::EventObject *MakeObject() const override { return new Self(m_Algorithm); }
60 
65  const mitk::NonBlockingAlgorithm *GetAlgorithm() const { return m_Algorithm.GetPointer(); }
66 
68  NonBlockingAlgorithmEvent(const Self &s) : itk::AnyEvent(s), m_Algorithm(s.m_Algorithm){};
69 
70  protected:
71  mitk::NonBlockingAlgorithm::ConstPointer m_Algorithm;
72 
73  private:
74  void operator=(const Self &);
75  };
76 
86  {
87  public:
92  ResultAvailable(const NonBlockingAlgorithm *algorithm = nullptr) : NonBlockingAlgorithmEvent(algorithm) {}
93  ~ResultAvailable() override {}
94  };
95 
105  {
106  public:
111  ProcessingError(const NonBlockingAlgorithm *algorithm = nullptr) : NonBlockingAlgorithmEvent(algorithm) {}
112  ~ProcessingError() override {}
113  };
114 }
115 
116 #endif
Base event class for NonBlockingAlgorithm notifications.
NonBlockingAlgorithmEvent(const NonBlockingAlgorithm *algorithm=nullptr)
Construct the event, optionally referencing the originating algorithm.
mitk::NonBlockingAlgorithm::ConstPointer m_Algorithm
The algorithm that raised this event.
bool CheckEvent(const ::itk::EventObject *e) const override
Check whether a given event object is of this type.
NonBlockingAlgorithmEvent(const Self &s)
Copy constructor.
const char * GetEventName() const override
Return the human-readable name of this event.
::itk::EventObject * MakeObject() const override
Create a copy of this event on the heap.
const mitk::NonBlockingAlgorithm * GetAlgorithm() const
Get the algorithm that raised this event.
Base class for algorithms that can run in a background thread.
Event indicating that a NonBlockingAlgorithm has encountered an error.
ProcessingError(const NonBlockingAlgorithm *algorithm=nullptr)
Construct the event.
Event indicating that a NonBlockingAlgorithm has produced a result.
ResultAvailable(const NonBlockingAlgorithm *algorithm=nullptr)
Construct the event.
Find image slices visible on a given plane.