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