SimpleITK  
sitkMemberFunctionFactory.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 sitkMemberFunctionFactory_h
19#define sitkMemberFunctionFactory_h
20
21#include "sitkDetail.h"
23#include "sitkPixelIDValues.h"
24
25namespace itk::simple::detail
26{
27
50template <typename TMemberFunctionPointer>
51class MemberFunctionFactory : protected MemberFunctionFactoryBase<TMemberFunctionPointer, std::pair<unsigned int, int>>
52{
53
54public:
57
58 using MemberFunctionType = TMemberFunctionPointer;
59 using ObjectType = typename ::detail::FunctionTraits<MemberFunctionType>::ClassType;
61
63
69 template <typename TImageType>
70 void
71 Register(MemberFunctionType pfunc, TImageType *);
72
113 template <typename TPixelIDTypeList, unsigned int VImageDimension, typename TAddressor>
114 void
116 template <typename TPixelIDTypeList, unsigned int VImageDimension>
117 void
123
124 template <typename TPixelIDTypeList, unsigned int VImageDimension, unsigned int VImageDimensionStop>
125 void
131 template <typename TPixelIDTypeList,
132 unsigned int VImageDimension,
133 unsigned int VImageDimensionStop,
134 typename TAddressor>
135 void
137 {
139 if constexpr (VImageDimensionStop > VImageDimension)
140 {
141 this->RegisterMemberFunctions<TPixelIDTypeList, VImageDimension, VImageDimensionStop - 1, TAddressor>();
142 }
143 }
144
145
149 bool
150 HasMemberFunction(PixelIDValueType pixelID, unsigned int imageDimension) const noexcept;
151
172 GetMemberFunction(PixelIDValueType pixelID, unsigned int imageDimension, ObjectType * objectPointer) const;
173};
174
175} // namespace itk::simple::detail
176
177#include "sitkMemberFunctionFactory.hxx"
178
179#endif // sitkMemberFunctionFactory_h
typename ::detail::FunctionTraits< MemberFunctionType >::ClassType ObjectType
typename Superclass::FunctionObjectType FunctionObjectType
void Register(MemberFunctionType pfunc, TImageType *)
Registers a specific member function.
FunctionObjectType GetMemberFunction(PixelIDValueType pixelID, unsigned int imageDimension, ObjectType *objectPointer) const
Returns a function object for the PixelID and image dimension.
void RegisterMemberFunctions()
Registers all member functions in TPixelIDTypeList and simple::InstantiatedPixelIDTypeList over itk::...
MemberFunctionFactoryBase< TMemberFunctionPointer, std::pair< unsigned int, int > > Superclass
void RegisterMemberFunctions()
Registers all member functions in TPixelIDTypeList and simple::InstantiatedPixelIDTypeList over itk::...
void RegisterMemberFunctions()
Registers all member functions in TPixelIDTypeList and simple::InstantiatedPixelIDTypeList over itk::...
bool HasMemberFunction(PixelIDValueType pixelID, unsigned int imageDimension) const noexcept
Query to determine if an member function has been registered for pixelID and imageDimension.