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

itkFEMP.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkFEMP.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:43 $ 00007 Version: $Revision: 1.10 $ 00008 00009 Copyright (c) Insight Software 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 __itkFEMP_h 00018 #define __itkFEMP_h 00019 00020 namespace itk { 00021 namespace fem { 00022 00023 00024 00025 00045 template<class T> 00046 class FEMP 00047 { 00048 public: 00049 00055 FEMP() : m_Data(0) 00056 { 00057 } 00058 00063 FEMP(const FEMP& x) 00064 { 00065 if (x.m_Data) { m_Data=static_cast<T*>(&*x.m_Data->Clone()); } 00066 else { m_Data=0; } 00067 } 00068 00075 explicit FEMP(typename T::Pointer x) : m_Data(x) 00076 { 00077 } 00078 00082 ~FEMP() 00083 { 00084 #ifndef FEM_USE_SMART_POINTERS 00085 delete m_Data; 00086 #endif 00087 } 00088 00092 const FEMP& operator= (const FEMP &rhs); 00093 00097 typename T::Pointer operator-> () const { return m_Data; } 00098 00103 operator T * () const 00104 { 00105 return m_Data; 00106 } 00107 00112 bool IsNULL() const 00113 { 00114 return (m_Data==0); 00115 } 00116 00117 private: 00118 00122 typename T::Pointer m_Data; 00123 00124 }; 00125 00126 00127 00128 00129 template<class T> 00130 const FEMP<T>& FEMP<T>::operator= (const FEMP &rhs) 00131 { 00132 00134 if (&rhs!=this) 00135 { 00139 #ifndef FEM_USE_SMART_POINTERS 00140 delete m_Data; 00141 #else 00142 m_Data=0; 00143 #endif 00144 00149 if (rhs.m_Data) { m_Data=static_cast<T*>(&*rhs.m_Data->Clone()); } 00150 else { m_Data=0; } 00151 00152 } 00153 return *this; 00154 } 00155 00156 00157 00158 00159 }} // end namespace itk::fem 00160 00161 #endif // #ifndef __itkFEMP_h

Generated at Sun Apr 1 02:28:24 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000