00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkSmartPointerForwardReference_h
00018 #define __itkSmartPointerForwardReference_h
00019
00020 #include "itkMacro.h"
00021 #include "itkWeakPointer.h"
00022
00023 #include <iostream>
00024
00025 namespace itk
00026 {
00027
00047 template <class T>
00048 class ITK_EXPORT SmartPointerForwardReference
00049 {
00050 public:
00052 SmartPointerForwardReference ()
00053 {m_Pointer = 0;}
00054
00056 SmartPointerForwardReference (const SmartPointerForwardReference<T> &p);
00057
00059 SmartPointerForwardReference (const WeakPointer<T> &p);
00060
00062 SmartPointerForwardReference (T *p);
00063
00065 ~SmartPointerForwardReference ();
00066
00068 T *operator -> () const;
00069
00071 operator T * () const;
00072
00074 T *GetPointer () const;
00075
00077 bool operator < (const SmartPointerForwardReference &r);
00078
00080 bool operator > (const SmartPointerForwardReference &r);
00081
00083 bool operator <= (const SmartPointerForwardReference &r);
00084
00086 bool operator >= (const SmartPointerForwardReference &r);
00087
00089 SmartPointerForwardReference &operator = (const SmartPointerForwardReference &r);
00090
00092 SmartPointerForwardReference &operator = (const WeakPointer<T> &r);
00093
00095 SmartPointerForwardReference &operator = (T *r);
00096
00098 T *Print (std::ostream& os) const;
00099
00100 private:
00102 T* m_Pointer;
00103
00104 void Register();
00105 void UnRegister();
00106
00107 };
00108
00109 template <typename T>
00110 std::ostream& operator<< (std::ostream& os, SmartPointerForwardReference<T> p)
00111 {
00112 p.Print(os);
00113 return os;
00114 }
00115
00116 }
00117
00118 #endif
00119