SimpleITK  
sitkDualMemberFunctionFactory.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 sitkDualMemberFunctionFactory_h
19#define sitkDualMemberFunctionFactory_h
20
21#include "sitkDetail.h"
23
24
25namespace itk::simple::detail
26{
27
28
59template <typename TMemberFunctionPointer,
60 typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>,
61 TMemberFunctionPointer,
64 : protected MemberFunctionFactoryBase<TMemberFunctionPointer,
65 std::tuple<unsigned int, int, unsigned int, int>,
66 TContainer>
67{
68
69public:
70 using Superclass =
73
74 using MemberFunctionType = TMemberFunctionPointer;
75 using ObjectType = typename ::detail::FunctionTraits<MemberFunctionType>::ClassType;
77
81
84
88 template <typename TImageType1, typename TImageType2>
89 void
90 Register(MemberFunctionType pfunc, TImageType1 *, TImageType2 *);
91
129 template <typename TPixelIDTypeList1, typename TPixelIDTypeList2, unsigned int VImageDimension, typename TAddressor>
130 void
132 template <typename TPixelIDTypeList1, typename TPixelIDTypeList2, unsigned int VImageDimension>
133 void
139
140 template <typename TPixelIDTypeList, unsigned int VImageDimension, typename TAddressor>
141 void
143 template <typename TPixelIDTypeList, unsigned int VImageDimension>
144 void
150
153 template <typename TPixelIDTypeList,
154 unsigned int VImageDimension,
155 unsigned int VImageDimensionStop,
156 typename TAddressor>
157 void
159 {
161 if constexpr (VImageDimensionStop > VImageDimension)
162 {
163 this->RegisterMemberFunctions<TPixelIDTypeList, VImageDimension, VImageDimensionStop - 1, TAddressor>();
164 }
165 }
166 template <typename TPixelIDTypeList, unsigned int VImageDimension, unsigned int VImageDimensionStop>
167 void
173
174
188 template <typename TPixelIDTypeList1, typename TPixelIDTypeList2, unsigned int VImageDimension, typename TAddressor>
189 void
191 template <typename TPixelIDTypeList1, typename TPixelIDTypeList2, unsigned int VImageDimension>
192 void
198
199
203 bool
204 HasMemberFunction(PixelIDValueType pixelID1, PixelIDValueType pixelID2, unsigned int imageDimension) const noexcept;
205
206
233 PixelIDValueType pixelID2,
234 unsigned int imageDimension,
235 ObjectType * objectPointer) const;
236};
237
238} // namespace itk::simple::detail
239
240#include "sitkDualMemberFunctionFactory.hxx"
241
242#endif // sitkDualMemberFunctionFactory_h
void Register(MemberFunctionType pfunc, TImageType1 *, TImageType2 *)
Registers a specific member function.
void RegisterMemberFunctionsZipped()
Register a member function for each position-matched pair of types from two equal-length pixel ID typ...
typename ::detail::FunctionTraits< MemberFunctionType >::ClassType ObjectType
bool HasMemberFunction(PixelIDValueType pixelID1, PixelIDValueType pixelID2, unsigned int imageDimension) const noexcept
Query to determine if an member function has been registered for pixelID1, pixelID2 and imageDimensio...
void RegisterMemberFunctions()
Registers the member functions for all combinations of TPixelIDTypeList1 and PixelIDTypeList2.
void RegisterMemberFunctionsZipped()
Register a member function for each position-matched pair of types from two equal-length pixel ID typ...
DualMemberFunctionFactory()=default
Constructor which permanently binds the constructed object to pObject.
FunctionObjectType GetMemberFunction(PixelIDValueType pixelID1, PixelIDValueType pixelID2, unsigned int imageDimension, ObjectType *objectPointer) const
Returns a function object for the combination of PixelID1 and PixelID2, and image dimension,...
void RegisterMemberFunctions()
Registers the member functions for all combinations of TPixelIDTypeList1 and PixelIDTypeList2.
void RegisterMemberFunctions()
Registers the member functions for all combinations of TPixelIDTypeList1 and PixelIDTypeList2.
MemberFunctionFactoryBase< TMemberFunctionPointer, std::tuple< unsigned int, int, unsigned int, int >, TContainer > Superclass
typename Superclass::FunctionObjectType FunctionObjectType