13 #ifndef mitkReferenceCountWatcher_h
14 #define mitkReferenceCountWatcher_h
16 #include "itkCommand.h"
29 typedef itk::SimpleMemberCommand<ReferenceCountWatcher>
CommandType;
83 return m_Object->GetReferenceCount();
88 itkGetStringMacro(Comment);
Keeps track of the reference count of an object even if it is destroyed.
~ReferenceCountWatcher() override
Destructor: remove observer.
bool m_Deleted
If true, m_Object is no longer valid and the returned reference count will be 0.
void DeleteObserver()
Callback called on itk::DeleteEvent() of wathched object.
ReferenceCountWatcher(itk::Object *o, const char *comment="")
Constructor requiring object to be watched and allowing an optional comment.
itk::Object * m_Object
Object to be watched.
mitkClassMacroItkParent(ReferenceCountWatcher, itk::Object)
itk::SimpleMemberCommand< ReferenceCountWatcher > CommandType
int GetReferenceCount() const override
Return the reference count of the watched object or 0 if it has been destroyed.
std::string m_Comment
Optional comment, e.g. for debugging output.
unsigned long m_ObserverTag
CommandType::Pointer m_DeleteCommand
itk::Command to get a notification when the object is deleted.
Find image slices visible on a given plane.