ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkNodePair.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 
00019 #ifndef __itkNodePair_h
00020 #define __itkNodePair_h
00021 
00022 #include <utility>
00023 
00024 namespace itk
00025 {
00032 template<class TNode, class TOutputPixel>
00033 class NodePair : private std::pair< TNode, TOutputPixel >
00034   {
00035 public:
00036   typedef NodePair                         Self;
00037   typedef std::pair< TNode, TOutputPixel > Superclass;
00038 
00039   typedef TNode         NodeType;
00040   typedef TOutputPixel  OutputPixelType;
00041 
00042   NodePair() : Superclass() {}
00043   NodePair( const TNode& iNode, const TOutputPixel& iValue ) :
00044     Superclass( iNode, iValue ) {}
00045   NodePair( const Self& iPair ) : Superclass( iPair ) {}
00046 
00047   void operator = ( const Self& iPair )
00048     {
00049     this->first = iPair.first;
00050     this->second = iPair.second;
00051     }
00052 
00053   void SetValue( const TOutputPixel& iValue )
00054     {
00055     this->second = iValue;
00056     }
00057   const TOutputPixel & GetValue() const
00058     {
00059     return this->second;
00060     }
00061   TOutputPixel & GetValue()
00062     {
00063     return this->second;
00064     }
00065   void SetNode( const TNode& iNode )
00066     {
00067     this->first = iNode;
00068     }
00069   const TNode & GetNode() const
00070     {
00071     return this->first;
00072     }
00073   TNode & GetNode()
00074     {
00075     return this->first;
00076     }
00077 
00078   bool operator < ( const Self& iRight ) const
00079     {
00080     return this->second < iRight.second;
00081     }
00082 
00083   bool operator > ( const Self& iRight ) const
00084     {
00085     return this->second > iRight.second;
00086     }
00087 
00088   bool operator <= ( const Self& iRight ) const
00089     {
00090     return this->second <= iRight.second;
00091     }
00092 
00093   bool operator >= ( const Self& iRight ) const
00094     {
00095     return this->second >= iRight.second;
00096     }
00097   };
00098 
00099 }
00100 #endif // __itkFastMarchingTraits_h
00101