ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkNodePair.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef __itkNodePair_h
20 #define __itkNodePair_h
21 
22 #include <utility>
23 
24 namespace itk
25 {
32 template<class TNode, class TOutputPixel>
33 class NodePair : private std::pair< TNode, TOutputPixel >
34  {
35 public:
36  typedef NodePair Self;
37  typedef std::pair< TNode, TOutputPixel > Superclass;
38 
39  typedef TNode NodeType;
40  typedef TOutputPixel OutputPixelType;
41 
43  NodePair( const TNode& iNode, const TOutputPixel& iValue ) :
44  Superclass( iNode, iValue ) {}
45  NodePair( const Self& iPair ) : Superclass( iPair ) {}
46 
47  void operator = ( const Self& iPair )
48  {
49  this->first = iPair.first;
50  this->second = iPair.second;
51  }
52 
53  void SetValue( const TOutputPixel& iValue )
54  {
55  this->second = iValue;
56  }
57  const TOutputPixel & GetValue() const
58  {
59  return this->second;
60  }
61  TOutputPixel & GetValue()
62  {
63  return this->second;
64  }
65  void SetNode( const TNode& iNode )
66  {
67  this->first = iNode;
68  }
69  const TNode & GetNode() const
70  {
71  return this->first;
72  }
73  TNode & GetNode()
74  {
75  return this->first;
76  }
77 
78  bool operator < ( const Self& iRight ) const
79  {
80  return this->second < iRight.second;
81  }
82 
83  bool operator > ( const Self& iRight ) const
84  {
85  return this->second > iRight.second;
86  }
87 
88  bool operator <= ( const Self& iRight ) const
89  {
90  return this->second <= iRight.second;
91  }
92 
93  bool operator >= ( const Self& iRight ) const
94  {
95  return this->second >= iRight.second;
96  }
97  };
98 
99 }
100 #endif // __itkFastMarchingTraits_h
101