ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkSTLContainerAdaptor.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkSTLContainerAdaptor_h
00019 #define __itkSTLContainerAdaptor_h
00020 
00021 namespace itk
00022 {
00042 template< typename TContainer >
00043 class STLContainerAdaptor
00044 {
00045 public:
00046 
00047   typedef TContainer AdapteeType;
00048 
00049   typedef typename AdapteeType::Element          ElementType;
00050   typedef typename AdapteeType::STLContainerType TargetType;
00051 private:
00052 
00053   AdapteeType & m_AdapteeRef;
00054 
00057   STLContainerAdaptor(const STLContainerAdaptor & r);
00058 
00059   /* hide and avoid operator= */
00060   const STLContainerAdaptor & operator=(const STLContainerAdaptor & r);
00061 
00062 public:
00063   STLContainerAdaptor(AdapteeType & adaptee):m_AdapteeRef(adaptee) {}
00064 
00065   STLContainerAdaptor(AdapteeType *adaptee):m_AdapteeRef(*adaptee) {}
00066 
00067   ~STLContainerAdaptor()
00068   {
00069     m_AdapteeRef.Modified();
00070   }
00071 
00072   TargetType & GetSTLContainerRef()
00073   {
00074     return m_AdapteeRef.CastToSTLContainer();
00075   }
00076 };
00077 } // end namespace itk
00078 
00079 #endif
00080