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
24namespace itk
25{
32template <typename TNode, typename TOutputPixel>
33class NodePair : private std::pair<TNode, TOutputPixel>
34{
35public:
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
Represents a Node and its associated value (front value)
Definition: itkNodePair.h:34
bool operator<(const Self &iRight) const
Definition: itkNodePair.h:91
void SetNode(const TNode &iNode)
Definition: itkNodePair.h:75
TOutputPixel OutputPixelType
Definition: itkNodePair.h:40
TNode & GetNode()
Definition: itkNodePair.h:85
void operator=(const Self &iPair)
Definition: itkNodePair.h:53
std::pair< TNode, TOutputPixel > Superclass
Definition: itkNodePair.h:37
NodePair(const Self &iPair)
Definition: itkNodePair.h:48
TNode NodeType
Definition: itkNodePair.h:39
void SetValue(const TOutputPixel &iValue)
Definition: itkNodePair.h:60
bool operator>(const Self &iRight) const
Definition: itkNodePair.h:97
const TNode & GetNode() const
Definition: itkNodePair.h:80
NodePair(const TNode &iNode, const TOutputPixel &iValue)
Definition: itkNodePair.h:45
TOutputPixel & GetValue()
Definition: itkNodePair.h:70
bool operator<=(const Self &iRight) const
Definition: itkNodePair.h:103
bool operator>=(const Self &iRight) const
Definition: itkNodePair.h:109
const TOutputPixel & GetValue() const
Definition: itkNodePair.h:65
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....