00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSTLContainerAdaptor.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:24 $ 00007 Version: $Revision: 1.3 $ 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 __itkSTLContainerAdaptor_h 00018 #define __itkSTLContainerAdaptor_h 00019 00020 00021 namespace itk { 00022 00023 00035 template<typename TContainer> 00036 class STLContainerAdaptor 00037 { 00038 public: 00039 00040 typedef TContainer AdapteeType; 00041 00042 typedef typename AdapteeType::Element ElementType; 00043 typedef typename AdapteeType::STLContainerType TargetType; 00044 00045 private: 00046 00047 AdapteeType & m_AdapteeRef; 00048 00050 STLContainerAdaptor(const STLContainerAdaptor & r); 00051 00052 /* hide and avoid operator= */ 00053 const STLContainerAdaptor & operator=(const STLContainerAdaptor & r); 00054 00055 00056 public: 00057 STLContainerAdaptor(AdapteeType & adaptee) 00058 : m_AdapteeRef(adaptee) 00059 {} 00060 00061 STLContainerAdaptor(AdapteeType * adaptee) 00062 : m_AdapteeRef(*adaptee) 00063 {} 00064 00065 ~STLContainerAdaptor() 00066 { 00067 m_AdapteeRef.Modified(); 00068 } 00069 00070 TargetType & GetSTLContainerRef() 00071 { 00072 return m_AdapteeRef.CastToSTLContainer(); 00073 } 00074 00075 }; 00076 00077 00078 } // end namespace itk 00079 00080 #endif