00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSTLConstContainerAdaptor.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 __itkSTLConstContainerAdaptor_h 00018 #define __itkSTLConstContainerAdaptor_h 00019 00020 00021 namespace itk { 00022 00023 00037 template<typename TContainer> 00038 class STLConstContainerAdaptor 00039 { 00040 public: 00041 00042 typedef const TContainer AdapteeType; 00043 00044 typedef const typename AdapteeType::Element ElementType; 00045 typedef const typename AdapteeType::STLContainerType TargetType; 00046 00047 00048 private: 00049 00050 AdapteeType & m_AdapteeRef; 00051 00053 STLConstContainerAdaptor(const STLConstContainerAdaptor & r); 00054 00055 /* hide and avoid operator= */ 00056 const STLConstContainerAdaptor & operator=(const STLConstContainerAdaptor & r); 00057 00058 00059 public: 00060 00061 STLConstContainerAdaptor(AdapteeType & adaptee) 00062 : m_AdapteeRef(adaptee) 00063 {} 00064 00065 STLConstContainerAdaptor(AdapteeType * adaptee) 00066 : m_AdapteeRef(*adaptee) 00067 {} 00068 00069 TargetType & GetSTLConstContainerRef() 00070 { 00071 return m_AdapteeRef.CastToSTLConstContainer(); 00072 } 00073 00074 }; 00075 00076 00077 } // end namespace itk 00078 00079 #endif 00080