ITK  5.2.0
Insight Toolkit
itkCellInterfaceVisitor.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  * 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 #ifndef itkCellInterfaceVisitor_h
19 #define itkCellInterfaceVisitor_h
20 
21 #include "itkLightObject.h"
22 #include "itkObjectFactory.h"
23 #include "itkCommonEnums.h"
24 
25 namespace itk
26 {
27 // Forward reference of CellInterface because of circular #include dependencies
28 template <typename TPixelType, typename TCellTraits>
29 class ITK_TEMPLATE_EXPORT CellInterface;
30 
44 template <typename TPixelType, typename TCellTraits>
45 class ITK_TEMPLATE_EXPORT CellInterfaceVisitor : public LightObject
46 {
47 public:
48  ITK_DISALLOW_COPY_AND_MOVE(CellInterfaceVisitor);
49 
55  using CellIdentifier = typename TCellTraits::CellIdentifier;
56 
58  itkTypeMacro(CellInterfaceVisitor, LightObject);
59 
61  virtual void
62  VisitFromCell(CellIdentifier cellId, CellInterface<TPixelType, TCellTraits> *) = 0;
63 
65  virtual CellGeometryEnum
66  GetCellTopologyId() = 0;
67 
68 protected:
69  CellInterfaceVisitor() = default;
70  ~CellInterfaceVisitor() override = default;
71 };
72 
99 template <typename TPixelType, typename TCellTraits, typename CellTopology, typename UserVisitor>
101  : public CellInterfaceVisitor<TPixelType, TCellTraits>
102  , public UserVisitor
103 {
104 public:
105  ITK_DISALLOW_COPY_AND_MOVE(CellInterfaceVisitorImplementation);
106 
110  using CellIdentifier = typename TCellTraits::CellIdentifier;
111 
113  itkNewMacro(Self);
114 
117 
121  GetCellTopologyId() override
122  {
123  return CellTopology::GetTopologyId();
124  }
125 
128  void
130  {
131  this->UserVisitor::Visit(cellId, (CellTopology *)c);
132  }
133 
134 protected:
136  ~CellInterfaceVisitorImplementation() override = default;
137 };
138 } // end namespace itk
139 
140 #endif
itkObjectFactory.h
itk::CellInterfaceVisitorImplementation::VisitFromCell
void VisitFromCell(CellIdentifier cellId, CellInterface< TPixelType, TCellTraits > *c) override
Definition: itkCellInterfaceVisitor.h:129
itk::CellInterfaceVisitorImplementation::CellInterfaceVisitorImplementation
CellInterfaceVisitorImplementation()=default
itk::CellInterfaceVisitor
Abstract interface for a visitor class that can visit the cells in a Mesh.
Definition: itkCellInterfaceVisitor.h:45
itk::SmartPointer< Self >
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::CellInterfaceVisitorImplementation
A template class used to implement a visitor object.
Definition: itkCellInterfaceVisitor.h:100
itk::CellInterfaceVisitorImplementation::GetCellTopologyId
CellGeometryEnum GetCellTopologyId() override
Definition: itkCellInterfaceVisitor.h:121
itk::CommonEnums::CellGeometry
CellGeometry
Definition: itkCommonEnums.h:138
itk::CellInterfaceVisitorImplementation::~CellInterfaceVisitorImplementation
~CellInterfaceVisitorImplementation() override=default
itk::CellInterface
An abstract interface for cells.
Definition: itkCellInterface.h:96
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkCommonEnums.h
itk::CellInterfaceVisitor::CellIdentifier
typename TCellTraits::CellIdentifier CellIdentifier
Definition: itkCellInterfaceVisitor.h:55
itkLightObject.h