00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __itkObject_h
00021 #define __itkObject_h
00022
00023 #include "itkLightObject.h"
00024 #include "itkEventObject.h"
00025
00026 namespace itk
00027 {
00028 class SubjectImplementation;
00029 class Command;
00030
00043 class ITK_EXPORT Object: public LightObject
00044 {
00045 public:
00047 typedef Object Self;
00048 typedef LightObject Superclass;
00049 typedef SmartPointer<Self> Pointer;
00050 typedef SmartPointer<const Self> ConstPointer;
00051
00053 static Pointer New();
00054
00056 itkTypeMacro(Object, LightObject);
00057
00059 virtual void DebugOn() const;
00060
00062 virtual void DebugOff() const;
00063
00065 bool GetDebug() const;
00066
00068 void SetDebug(bool debugFlag) const;
00069
00071 virtual unsigned long GetMTime() const;
00072
00075 virtual void Modified() const;
00076
00078 virtual void Register() const;
00079
00081 virtual void UnRegister() const;
00082
00084 virtual void SetReferenceCount(int);
00085
00088 static void SetGlobalWarningDisplay(bool flag);
00089 static bool GetGlobalWarningDisplay();
00090 static void GlobalWarningDisplayOn()
00091 { Object::SetGlobalWarningDisplay(true); }
00092 static void GlobalWarningDisplayOff()
00093 { Object::SetGlobalWarningDisplay(false); }
00094
00103 unsigned long AddObserver(const EventObject & event, Command *);
00104
00110 Command* GetCommand(unsigned long tag);
00111
00113 void InvokeEvent( const EventObject & );
00114
00117 void InvokeEvent( const EventObject & ) const;
00118
00120 void RemoveObserver(unsigned long tag);
00121
00123 bool HasObserver( const EventObject & event ) const;
00124
00125 protected:
00126 Object();
00127 virtual ~Object();
00128
00133 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00134
00135 bool PrintObservers(std::ostream& os, Indent indent) const;
00136
00137 private:
00138 Object(const Self&);
00139 void operator=(const Self&);
00140
00142 mutable bool m_Debug;
00143
00145 mutable TimeStamp m_MTime;
00146
00148 static bool m_GlobalWarningDisplay;
00149
00152 SubjectImplementation* m_SubjectImplementation;
00153 };
00154
00155 }
00156
00157 #endif
00158