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 #include "itkMetaDataDictionary.h"
00026
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); }
00103
00112 unsigned long AddObserver(const EventObject & event, Command *);
00113 unsigned long AddObserver(const EventObject & event, Command *) const;
00115
00121 Command* GetCommand(unsigned long tag);
00122
00124 void InvokeEvent( const EventObject & );
00125
00128 void InvokeEvent( const EventObject & ) const;
00129
00131 void RemoveObserver(unsigned long tag);
00132
00134 void RemoveAllObservers();
00135
00137 bool HasObserver( const EventObject & event ) const;
00138
00143 MetaDataDictionary & GetMetaDataDictionary(void);
00144
00148 const MetaDataDictionary & GetMetaDataDictionary(void) const;
00149
00153 void SetMetaDataDictionary(const MetaDataDictionary & rhs);
00154
00155
00156 protected:
00157 Object();
00158 virtual ~Object();
00159
00164 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00165
00166 bool PrintObservers(std::ostream& os, Indent indent) const;
00167
00168 private:
00169 Object(const Self&);
00170 void operator=(const Self&);
00171
00173 mutable bool m_Debug;
00174
00176 mutable TimeStamp m_MTime;
00177
00179 static bool m_GlobalWarningDisplay;
00180
00183 SubjectImplementation* m_SubjectImplementation;
00184
00192 mutable MetaDataDictionary * m_MetaDataDictionary;
00193 };
00194
00195 }
00196
00197 #endif
00198
00199