ITK  6.0.0
Insight Toolkit
itkNodePair.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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 <typename TNode, typename TOutputPixel>
33 class NodePair : private std::pair<TNode, TOutputPixel>
34 {
35 public:
36  using Self = NodePair;
37  using Superclass = std::pair<TNode, TOutputPixel>;
38 
39  using NodeType = TNode;
40  using OutputPixelType = TOutputPixel;
41 
43  : Superclass()
44  {}
45  NodePair(const TNode & iNode, const TOutputPixel & iValue)
46  : Superclass(iNode, iValue)
47  {}
48  NodePair(const Self & iPair)
49  : Superclass(iPair)
50  {}
51 
52  void
53  operator=(const Self & iPair)
54  {
55  this->first = iPair.first;
56  this->second = iPair.second;
57  }
58 
59  void
60  SetValue(const TOutputPixel & iValue)
61  {
62  this->second = iValue;
63  }
64  const TOutputPixel &
65  GetValue() const
66  {
67  return this->second;
68  }
69  TOutputPixel &
71  {
72  return this->second;
73  }
74  void
75  SetNode(const TNode & iNode)
76  {
77  this->first = iNode;
78  }
79  const TNode &
80  GetNode() const
81  {
82  return this->first;
83  }
84  TNode &
86  {
87  return this->first;
88  }
89 
90  bool
91  operator<(const Self & iRight) const
92  {
93  return this->second < iRight.second;
94  }
95 
96  bool
97  operator>(const Self & iRight) const
98  {
99  return this->second > iRight.second;
100  }
101 
102  bool
103  operator<=(const Self & iRight) const
104  {
105  return this->second <= iRight.second;
106  }
107 
108  bool
109  operator>=(const Self & iRight) const
110  {
111  return this->second >= iRight.second;
112  }
113 };
114 
115 } // end namespace itk
116 #endif // itkNodePair_h
itk::NodePair::SetNode
void SetNode(const TNode &iNode)
Definition: itkNodePair.h:75
itk::NodePair::NodeType
TNode NodeType
Definition: itkNodePair.h:39
itk::NodePair::operator=
void operator=(const Self &iPair)
Definition: itkNodePair.h:53
itk::NodePair::NodePair
NodePair(const Self &iPair)
Definition: itkNodePair.h:48
itk::NodePair::OutputPixelType
TOutputPixel OutputPixelType
Definition: itkNodePair.h:40
itk::NodePair::GetNode
TNode & GetNode()
Definition: itkNodePair.h:85
itk::NodePair::Superclass
std::pair< TNode, TOutputPixel > Superclass
Definition: itkNodePair.h:37
itk::NodePair::operator>
bool operator>(const Self &iRight) const
Definition: itkNodePair.h:97
itk::NodePair::operator<
bool operator<(const Self &iRight) const
Definition: itkNodePair.h:91
itk::NodePair
Represents a Node and its associated value (front value)
Definition: itkNodePair.h:33
itk::NodePair::GetValue
TOutputPixel & GetValue()
Definition: itkNodePair.h:70
itk::NodePair::operator<=
bool operator<=(const Self &iRight) const
Definition: itkNodePair.h:103
itk::NodePair::operator>=
bool operator>=(const Self &iRight) const
Definition: itkNodePair.h:109
itk::NodePair::GetNode
const TNode & GetNode() const
Definition: itkNodePair.h:80
itk::NodePair::SetValue
void SetValue(const TOutputPixel &iValue)
Definition: itkNodePair.h:60
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::NodePair::NodePair
NodePair(const TNode &iNode, const TOutputPixel &iValue)
Definition: itkNodePair.h:45
itk::NodePair::NodePair
NodePair()
Definition: itkNodePair.h:42
itk::NodePair::GetValue
const TOutputPixel & GetValue() const
Definition: itkNodePair.h:65