Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkOperation.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 mitkOperation_h
14 #define mitkOperation_h
15 
16 #include <MitkCoreExports.h>
17 #include <itkEventObject.h>
18 
19 #include <mitkCommon.h>
20 
21 namespace mitk
22 {
24  typedef int OperationType;
25 
38  {
39  public:
41 
42 
50  virtual bool IsValid() const;
51 
53  virtual ~Operation() = default;
54 
60 
61  protected:
66  Operation(OperationType operationType);
67  Operation(const Operation&) = default;
68  Operation(Operation&&) = default;
69  Operation& operator=(const Operation&) = default;
70  Operation& operator=(Operation&&) = default;
71 
73  };
74 
83  class MITKCORE_EXPORT OperationEndEvent : public itk::EndEvent
84  {
85  public:
87  typedef itk::EndEvent Superclass;
88 
93  OperationEndEvent(Operation *operation = nullptr) : m_Operation(operation) {}
95  ~OperationEndEvent() override {}
97  const char *GetEventName() const override { return "OperationEndEvent"; }
99  bool CheckEvent(const ::itk::EventObject *e) const override { return dynamic_cast<const Self *>(e); }
101  ::itk::EventObject *MakeObject() const override { return new Self(m_Operation); }
103  Operation *GetOperation() const { return m_Operation; }
104  private:
105  Operation *m_Operation;
106  OperationEndEvent(const Self &);
107  void operator=(const Self &);
108  };
109 
110 } // namespace mitk
111 #endif
#define MITKCORE_EXPORT
ITK event fired after an operation has been executed.
Definition: mitkOperation.h:84
OperationEndEvent Self
Definition: mitkOperation.h:86
OperationEndEvent(Operation *operation=nullptr)
Construct an OperationEndEvent.
Definition: mitkOperation.h:93
itk::EndEvent Superclass
Definition: mitkOperation.h:87
bool CheckEvent(const ::itk::EventObject *e) const override
Check event type compatibility.
Definition: mitkOperation.h:99
const char * GetEventName() const override
Get the event name.
Definition: mitkOperation.h:97
::itk::EventObject * MakeObject() const override
Clone this event.
Operation * GetOperation() const
Get the associated operation.
~OperationEndEvent() override
Destructor.
Definition: mitkOperation.h:95
Base class for all operations in the undo/redo framework.
Definition: mitkOperation.h:38
OperationType m_OperationType
The type identifier for this operation.
Definition: mitkOperation.h:72
virtual ~Operation()=default
Virtual destructor.
Operation(const Operation &)=default
Operation & operator=(const Operation &)=default
OperationType GetOperationType()
Get the type identifier of this operation.
Operation & operator=(Operation &&)=default
Operation(Operation &&)=default
mitkClassMacroNoParent(Operation) virtual bool IsValid() const
Check whether this operation is still valid and can be executed.
Operation(OperationType operationType)
Construct an operation with the given type.
Find image slices visible on a given plane.
int OperationType
Type alias for operation type identifiers.
Definition: mitkOperation.h:24