|
Medical Imaging Interaction Toolkit
2025.08.00
Medical Imaging Interaction Toolkit
|
Convenience class that helps to manage the lifetime of itk event observers. More...
#include <mitkITKEventObserverGuard.h>
Public Member Functions | |
| ITKEventObserverGuard () | |
| ITKEventObserverGuard (const itk::Object *sender, unsigned long observerTag) | |
| ITKEventObserverGuard (const itk::Object *sender, const itk::EventObject &event, itk::Command *command) | |
| ITKEventObserverGuard (const itk::Object *sender, const itk::EventObject &event, std::function< void(const itk::EventObject &)> function) | |
| ITKEventObserverGuard (ITKEventObserverGuard &&) | |
| ITKEventObserverGuard & | operator= (ITKEventObserverGuard &&) |
| ~ITKEventObserverGuard () | |
| void | Reset () |
| void | Reset (const itk::Object *sender, unsigned long observerTag) |
| void | Reset (const itk::Object *sender, const itk::EventObject &event, itk::Command *command) |
| void | Reset (const itk::Object *sender, const itk::EventObject &event, std::function< void(const itk::EventObject &)> function) |
| bool | IsInitialized () const |
Convenience class that helps to manage the lifetime of itk event observers.
This helper class can be used to ensure itk event observers are removed form a sender object at the end of a certain scope. This class behaves similar to a std::unique_ptr but for event observers. Therefore the observer will be removed from the sender when one of the following conditions are met:
Sample usage:
This will add an Observer to o executing the lambda for any event as long as the guard exists.
Definition at line 55 of file mitkITKEventObserverGuard.h.
| mitk::ITKEventObserverGuard::ITKEventObserverGuard | ( | ) |
| mitk::ITKEventObserverGuard::ITKEventObserverGuard | ( | const itk::Object * | sender, |
| unsigned long | observerTag | ||
| ) |
| mitk::ITKEventObserverGuard::ITKEventObserverGuard | ( | const itk::Object * | sender, |
| const itk::EventObject & | event, | ||
| itk::Command * | command | ||
| ) |
| mitk::ITKEventObserverGuard::ITKEventObserverGuard | ( | const itk::Object * | sender, |
| const itk::EventObject & | event, | ||
| std::function< void(const itk::EventObject &)> | function | ||
| ) |
| mitk::ITKEventObserverGuard::ITKEventObserverGuard | ( | ITKEventObserverGuard && | ) |
| mitk::ITKEventObserverGuard::~ITKEventObserverGuard | ( | ) |
| bool mitk::ITKEventObserverGuard::IsInitialized | ( | ) | const |
| ITKEventObserverGuard& mitk::ITKEventObserverGuard::operator= | ( | ITKEventObserverGuard && | ) |
| void mitk::ITKEventObserverGuard::Reset | ( | ) |
Resets the guard by removing the currently guarded observer. After the reset the guard is uninitialized.
| void mitk::ITKEventObserverGuard::Reset | ( | const itk::Object * | sender, |
| const itk::EventObject & | event, | ||
| itk::Command * | command | ||
| ) |
Resets the guard by first removing the currently guarded observer. Then a observer will be added for the passed sender with the passed event and command. The new observer is now guarded.
| void mitk::ITKEventObserverGuard::Reset | ( | const itk::Object * | sender, |
| const itk::EventObject & | event, | ||
| std::function< void(const itk::EventObject &)> | function | ||
| ) |
Resets the guard by first removing the currently guarded observer. Then a observer will be added for the passed sender with the passed event and lambda function. The new observer is now guarded.
| void mitk::ITKEventObserverGuard::Reset | ( | const itk::Object * | sender, |
| unsigned long | observerTag | ||
| ) |
Resets the guard by first removing the currently guarded observer. Then the passed observer tag for the passed sender will be guarded.