igtlLightObject.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef __igtlLightObject_h
00033 #define __igtlLightObject_h
00034
00035 #include "igtlSmartPointer.h"
00036 #include "igtlSimpleFastMutexLock.h"
00037 #include "igtlMacro.h"
00038
00039 #include <iostream>
00040 #include <typeinfo>
00041
00042
00043 namespace igtl
00044 {
00045
00060 class IGTLCommon_EXPORT LightObject
00061 {
00062 public:
00064 typedef LightObject Self;
00065 typedef SmartPointer<Self> Pointer;
00066 typedef SmartPointer<const Self> ConstPointer;
00067
00069 static Pointer New();
00070
00076 virtual Pointer CreateAnother() const;
00077
00081 virtual void Delete();
00082
00086 virtual const char *GetNameOfClass() const
00087 {return "LightObject";}
00088
00089 #ifdef _WIN32
00090
00091 void* operator new(size_t);
00092 void* operator new[](size_t);
00093 void operator delete(void*);
00094 void operator delete[](void*, size_t);
00095 #endif
00096
00097
00099 void Print(std::ostream& os) const;
00100
00103 static void BreakOnError();
00104
00106 virtual void Register() const;
00107
00109 virtual void UnRegister() const;
00110
00112 virtual int GetReferenceCount() const
00113 {return m_ReferenceCount;}
00114
00117 virtual void SetReferenceCount(int);
00118
00119 protected:
00120 LightObject():m_ReferenceCount(1) {}
00121 virtual ~LightObject();
00122
00127 virtual void PrintSelf(std::ostream& os) const;
00128 virtual void PrintHeader(std::ostream& os) const;
00129 virtual void PrintTrailer(std::ostream& os) const;
00131
00133 mutable volatile int m_ReferenceCount;
00134
00136 mutable SimpleFastMutexLock m_ReferenceCountLock;
00137
00138 private:
00139 LightObject(const Self&);
00140 void operator=(const Self&);
00141
00142
00143 };
00144
00145 }
00146
00147 #endif
00148