00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkLightObject_h
00018 #define __itkLightObject_h
00019
00020
00021
00022 #include <iostream>
00023 #include <typeinfo>
00024
00025 #include "itkSmartPointer.h"
00026 #include "itkTimeStamp.h"
00027 #include "itkIndent.h"
00028 #include "itkSimpleFastMutexLock.h"
00029
00030 #include "itkMacro.h"
00031
00032 namespace itk
00033 {
00034
00049 class ITK_EXPORT LightObject
00050 {
00051 public:
00053 typedef LightObject Self;
00054 typedef SmartPointer<Self> Pointer;
00055 typedef SmartPointer<const Self> ConstPointer;
00056
00058 static Pointer New();
00059
00063 virtual void Delete();
00064
00068 virtual const char *GetNameOfClass() const
00069 {return "LightObject";}
00070
00071 #ifdef _WIN32
00072
00073 void* operator new(size_t);
00074 void* operator new[](size_t);
00075 void operator delete(void*);
00076 void operator delete[](void*, size_t);
00077 #endif
00078
00080 void Print(std::ostream& os) const;
00081
00084 static void BreakOnError();
00085
00087 virtual void Register() const;
00088
00090 virtual void UnRegister() const;
00091
00093 virtual int GetReferenceCount() const
00094 {return m_ReferenceCount;}
00095
00098 virtual void SetReferenceCount(int);
00099
00100 protected:
00101 LightObject():m_ReferenceCount(1) {}
00102 virtual ~LightObject();
00103
00108 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00109 virtual void PrintHeader(std::ostream& os, Indent indent) const;
00110 virtual void PrintTrailer(std::ostream& os, Indent indent) const;
00111
00113 mutable int m_ReferenceCount;
00114
00116 mutable SimpleFastMutexLock m_ReferenceCountLock;
00117
00118 private:
00119 LightObject(const Self&);
00120 void operator=(const Self&);
00121
00122
00123 };
00124
00125 }
00126
00127 #endif