13 #ifndef mitkITKEventObserverGuard_h
14 #define mitkITKEventObserverGuard_h
87 ITKEventObserverGuard(
const itk::Object* sender,
const itk::EventObject& event, std::function<
void(
const itk::EventObject&)>
function);
116 void Reset(
const itk::Object* sender,
unsigned long observerTag);
128 void Reset(
const itk::Object* sender,
const itk::EventObject& event, itk::Command* command);
140 void Reset(
const itk::Object* sender,
const itk::EventObject& event, std::function<
void(
const itk::EventObject&)>
function);
151 std::unique_ptr<Impl> m_ITKEventObserverGuardImpl;
Convenience class that helps to manage the lifetime of itk event observers.
ITKEventObserverGuard(const itk::Object *sender, const itk::EventObject &event, std::function< void(const itk::EventObject &)> function)
Construct a guard that adds and manages an observer using a lambda or function.
ITKEventObserverGuard(ITKEventObserverGuard &&)
Move constructor. Transfers ownership of the guarded observer.
void Reset(const itk::Object *sender, unsigned long observerTag)
Reset the guard and start guarding a new observer tag.
ITKEventObserverGuard(const itk::Object *sender, const itk::EventObject &event, itk::Command *command)
Construct a guard that adds and manages an observer using an itk::Command.
void Reset(const itk::Object *sender, const itk::EventObject &event, std::function< void(const itk::EventObject &)> function)
Reset the guard and add a new observer using a lambda or function.
void Reset(const itk::Object *sender, const itk::EventObject &event, itk::Command *command)
Reset the guard and add a new observer using an itk::Command.
void Reset()
Reset the guard by removing the currently guarded observer.
bool IsInitialized() const
Check whether this guard is currently managing an observer.
ITKEventObserverGuard(const itk::Object *sender, unsigned long observerTag)
Construct a guard for an existing observer tag.
ITKEventObserverGuard()
Construct an uninitialized guard (no observer is guarded).
~ITKEventObserverGuard()
Destructor. Removes the guarded observer from the sender if still alive.
ITKEventObserverGuard & operator=(ITKEventObserverGuard &&)
Move assignment. Releases any currently guarded observer and takes ownership from the other guard.
Find image slices visible on a given plane.