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
00061 virtual LightObject::Pointer CreateAnother() const;
00062
00064 itkTypeMacro(Object, LightObject);
00065
00067 virtual void DebugOn() const;
00068
00070 virtual void DebugOff() const;
00071
00073 bool GetDebug() const;
00074
00076 void SetDebug(bool debugFlag) const;
00077
00079 virtual unsigned long GetMTime() const;
00080
00083 virtual void Modified() const;
00084
00086 virtual void Register() const;
00087
00089 virtual void UnRegister() const;
00090
00092 virtual void SetReferenceCount(int);
00093
00096 static void SetGlobalWarningDisplay(bool flag);
00097 static bool GetGlobalWarningDisplay();
00098 static void GlobalWarningDisplayOn()
00099 { Object::SetGlobalWarningDisplay(true); }
00100 static void GlobalWarningDisplayOff()
00101 { Object::SetGlobalWarningDisplay(false); }
00102
00111 unsigned long AddObserver(const EventObject & event, Command *);
00112 unsigned long AddObserver(const EventObject & event, Command *) const;
00113
00119 Command* GetCommand(unsigned long tag);
00120
00122 void InvokeEvent( const EventObject & );
00123
00126 void InvokeEvent( const EventObject & ) const;
00127
00129 void RemoveObserver(unsigned long tag);
00130
00132 void RemoveAllObservers();
00133
00135 bool HasObserver( const EventObject & event ) const;
00136
00141 MetaDataDictionary & GetMetaDataDictionary(void);
00142
00146 const MetaDataDictionary & GetMetaDataDictionary(void) const;
00147
00151 void SetMetaDataDictionary(const MetaDataDictionary & rhs);
00152
00153
00154 protected:
00155 Object();
00156 virtual ~Object();
00157
00162 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00163
00164 bool PrintObservers(std::ostream& os, Indent indent) const;
00165
00166 private:
00167 Object(const Self&);
00168 void operator=(const Self&);
00169
00171 mutable bool m_Debug;
00172
00174 mutable TimeStamp m_MTime;
00175
00177 static bool m_GlobalWarningDisplay;
00178
00181 SubjectImplementation* m_SubjectImplementation;
00189 mutable MetaDataDictionary * m_MetaDataDictionary;
00190 };
00191
00192 }
00193
00194 #endif
00195