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 #include "itkMetaDataDictionary.h"
00027 namespace itk
00028 {
00029 class SubjectImplementation;
00030 class Command;
00031
00044 class ITKCommon_EXPORT Object: public LightObject
00045 {
00046 public:
00048 typedef Object Self;
00049 typedef LightObject Superclass;
00050 typedef SmartPointer<Self> Pointer;
00051 typedef SmartPointer<const Self> ConstPointer;
00052
00054 static Pointer New();
00055
00057 itkTypeMacro(Object, LightObject);
00058
00060 virtual void DebugOn() const;
00061
00063 virtual void DebugOff() const;
00064
00066 bool GetDebug() const;
00067
00069 void SetDebug(bool debugFlag) const;
00070
00072 virtual unsigned long GetMTime() const;
00073
00076 virtual void Modified() const;
00077
00079 virtual void Register() const;
00080
00082 virtual void UnRegister() const;
00083
00085 virtual void SetReferenceCount(int);
00086
00089 static void SetGlobalWarningDisplay(bool flag);
00090 static bool GetGlobalWarningDisplay();
00091 static void GlobalWarningDisplayOn()
00092 { Object::SetGlobalWarningDisplay(true); }
00093 static void GlobalWarningDisplayOff()
00094 { Object::SetGlobalWarningDisplay(false); }
00095
00104 unsigned long AddObserver(const EventObject & event, Command *);
00105
00111 Command* GetCommand(unsigned long tag);
00112
00114 void InvokeEvent( const EventObject & );
00115
00118 void InvokeEvent( const EventObject & ) const;
00119
00121 void RemoveObserver(unsigned long tag);
00122
00124 bool HasObserver( const EventObject & event ) const;
00125
00130 MetaDataDictionary & GetMetaDataDictionary(void);
00131
00135 const MetaDataDictionary & GetMetaDataDictionary(void) const;
00136
00140 void SetMetaDataDictionary(const MetaDataDictionary & rhs);
00141
00142
00143 protected:
00144 Object();
00145 virtual ~Object();
00146
00151 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00152
00153 bool PrintObservers(std::ostream& os, Indent indent) const;
00154
00155 private:
00156 Object(const Self&);
00157 void operator=(const Self&);
00158
00160 mutable bool m_Debug;
00161
00163 mutable TimeStamp m_MTime;
00164
00166 static bool m_GlobalWarningDisplay;
00167
00170 SubjectImplementation* m_SubjectImplementation;
00178 mutable MetaDataDictionary * m_MetaDataDictionary;
00179 };
00180
00181 }
00182
00183 #endif
00184