Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkSmartPointerForwardReference.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkSmartPointerForwardReference.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/01/15 18:57:20 $
00007   Version:   $Revision: 1.7 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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 } // end namespace itk
00117   
00118 #endif

Generated at Fri May 21 01:15:19 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000