00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSimpleDataObjectDecorator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-04-21 14:20:10 $ 00007 Version: $Revision: 1.6 $ 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 Portions of this code are covered under the VTK copyright. 00013 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details. 00014 00015 This software is distributed WITHOUT ANY WARRANTY; without even 00016 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00017 PURPOSE. See the above copyright notices for more information. 00018 00019 =========================================================================*/ 00020 #ifndef __itkSimpleDataObjectDecorator_h 00021 #define __itkSimpleDataObjectDecorator_h 00022 00023 #include "itkDataObject.h" 00024 #include "itkObjectFactory.h" 00025 00026 namespace itk 00027 { 00028 00029 00058 template<class T> 00059 class ITK_EXPORT SimpleDataObjectDecorator : public DataObject 00060 { 00061 public: 00063 typedef SimpleDataObjectDecorator Self; 00064 typedef DataObject Superclass; 00065 typedef SmartPointer<Self> Pointer; 00066 typedef SmartPointer<const Self> ConstPointer; 00067 00069 typedef T ComponentType; 00070 00072 itkNewMacro(Self); 00073 00075 itkTypeMacro(SimpleDataObjectDecorator, DataObject); 00076 00078 virtual void Set(const T& val); 00079 00081 virtual T& Get() { return m_Component; } 00082 virtual const T& Get() const { return m_Component; } 00084 00085 00086 protected: 00087 SimpleDataObjectDecorator(); 00088 ~SimpleDataObjectDecorator(); 00089 virtual void PrintSelf(std::ostream& os, Indent indent) const; 00090 00091 protected: 00092 00093 private: 00094 SimpleDataObjectDecorator(const Self&); //purposely not implemented 00095 void operator=(const Self&); //purposely not implemented 00096 00097 ComponentType m_Component; 00098 bool m_Initialized; 00099 }; 00100 00101 } // end namespace itk 00102 00103 // Define instantiation macro for this template. 00104 #define ITK_TEMPLATE_SimpleDataObjectDecorator(_, EXPORT, x, y) namespace itk { \ 00105 _(1(class EXPORT SimpleDataObjectDecorator< ITK_TEMPLATE_1 x >)) \ 00106 namespace Templates { typedef SimpleDataObjectDecorator< ITK_TEMPLATE_1 x > \ 00107 SimpleDataObjectDecorator##y; } \ 00108 } 00109 00110 #if ITK_TEMPLATE_EXPLICIT 00111 # include "Templates/itkSimpleDataObjectDecorator+-.h" 00112 #endif 00113 00114 #if ITK_TEMPLATE_TXX 00115 # include "itkSimpleDataObjectDecorator.txx" 00116 #endif 00117 00118 #endif 00119