00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSTLConstContainerAdaptor.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-03-03 15:09:06 $ 00007 Version: $Revision: 1.4 $ 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) : m_AdapteeRef(adaptee) {} 00062 00063 STLConstContainerAdaptor(AdapteeType * adaptee) : m_AdapteeRef(*adaptee) {} 00064 00065 TargetType & GetSTLConstContainerRef() 00066 { 00067 return m_AdapteeRef.CastToSTLConstContainer(); 00068 } 00069 00070 }; 00071 00072 } // end namespace itk 00073 00074 #endif 00075