SimpleITK  
itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer > Class Template Reference

A class used to instantiate and generate function objects of templated member functions with two template arguments. More...

#include <sitkDualMemberFunctionFactory.h>

+ Inheritance diagram for itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >:
+ Collaboration diagram for itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >:

Detailed Description

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
class itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >

A class used to instantiate and generate function objects of templated member functions with two template arguments.

Template Parameters
TMemberFunctionPointeris the type of pointer to member function

Example member function and pointer:

template<typename TImageType1, TImageType2>
Image::Pointer ExecuteInternal( Image::Pointer );
SmartPointer< Self > Pointer

The provided Addressor will instantiate the templated member functions by taking the address in the RegisterMethods. Later they can be retrieve with the GetMemberFunction method, which returns a function object with the same arguments as the templated member function pointer.

An instance of a MemberFunctionFactory is bound to a specific instance of an object, so that the returned function object does not need to have the calling object specified.

Warning
Use this class with caution because it can instantiate a combinatorial number of methods.
See also
MemberFunctionFactory

Definition at line 63 of file sitkDualMemberFunctionFactory.h.

Public Types

using FunctionObjectType = typename Superclass::FunctionObjectType
 
using MemberFunctionType = TMemberFunctionPointer
 
using ObjectType = typename ::detail::FunctionTraits<MemberFunctionType>::ClassType
 
using Self = DualMemberFunctionFactory
 
using Superclass
 

Public Member Functions

 DualMemberFunctionFactory ()=default
 Constructor which permanently binds the constructed object to pObject.
 
constexpr double GetLoadFactor () const noexcept
 
constexpr std::size_t GetMaximumLoadFactor () const noexcept
 
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, with a object pointer.
 
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 imageDimension.
 
template<typename TImageType1, typename TImageType2>
void Register (MemberFunctionType pfunc, TImageType1 *, TImageType2 *)
 Registers a specific member function.
 
template<typename TPixelIDTypeList1, typename TPixelIDTypeList2, unsigned int VImageDimension, typename TAddressor>
void RegisterMemberFunctions ()
 Registers the member functions for all combinations of TPixelIDTypeList1 and PixelIDTypeList2.
 
template<typename TPixelIDTypeList1, typename TPixelIDTypeList2, unsigned int VImageDimension>
void RegisterMemberFunctions ()
 Registers the member functions for all combinations of TPixelIDTypeList1 and PixelIDTypeList2.
 
template<typename TPixelIDTypeList, unsigned int VImageDimension, typename TAddressor>
void RegisterMemberFunctions ()
 Registers the member functions for all combinations of TPixelIDTypeList1 and PixelIDTypeList2.
 
template<typename TPixelIDTypeList, unsigned int VImageDimension>
void RegisterMemberFunctions ()
 Registers the member functions for all combinations of TPixelIDTypeList1 and PixelIDTypeList2.
 

Member Typedef Documentation

◆ FunctionObjectType

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
using itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >::FunctionObjectType = typename Superclass::FunctionObjectType

Definition at line 76 of file sitkDualMemberFunctionFactory.h.

◆ MemberFunctionType

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
using itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >::MemberFunctionType = TMemberFunctionPointer

Definition at line 74 of file sitkDualMemberFunctionFactory.h.

◆ ObjectType

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
using itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >::ObjectType = typename ::detail::FunctionTraits<MemberFunctionType>::ClassType

Definition at line 75 of file sitkDualMemberFunctionFactory.h.

◆ Self

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
using itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >::Self = DualMemberFunctionFactory

Definition at line 72 of file sitkDualMemberFunctionFactory.h.

◆ Superclass

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
using itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >::Superclass

Constructor & Destructor Documentation

◆ DualMemberFunctionFactory()

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >::DualMemberFunctionFactory ( )
default

Member Function Documentation

◆ GetLoadFactor()

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
double itk::simple::detail::MemberFunctionFactoryBase< TMemberFunctionPointer, std::tuple< unsigned int, int, unsigned int, int >, TContainer >::GetLoadFactor ( ) const
inlinenodiscardconstexprnoexcept

Definition at line 100 of file sitkMemberFunctionFactoryBase.h.

◆ GetMaximumLoadFactor()

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
std::size_t itk::simple::detail::MemberFunctionFactoryBase< TMemberFunctionPointer, std::tuple< unsigned int, int, unsigned int, int >, TContainer >::GetMaximumLoadFactor ( ) const
inlinenodiscardconstexprnoexcept

Definition at line 106 of file sitkMemberFunctionFactoryBase.h.

◆ GetMemberFunction()

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
FunctionObjectType itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >::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, with a object pointer.

This overload of GetMemberFunction allows the caller to specify a custom object pointer type, which can be useful in certain situations where the object pointer type needs to be different from the one used during factory construction.

pixelID1 or pixelID2 is the value of Image::GetPixelIDValue(), or PixelIDToPixelIDValue<PixelIDType>::Result

imageDimension is the value returned by Image::GetDimension()

Example usage:

PixelIDValueType pixelID = image->GetPixelIDValue();
unsigned int dimension = image->GetDimension();
return this->m_MemberFactory->GetMemberFunction( pixelID, pixelID, dimension, objectPointer )( image );

If the requested member function is not registered then an exception is generated. The returned function object is guaranteed to be valid.

◆ HasMemberFunction()

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
bool itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >::HasMemberFunction ( PixelIDValueType pixelID1,
PixelIDValueType pixelID2,
unsigned int imageDimension ) const
noexcept

Query to determine if an member function has been registered for pixelID1, pixelID2 and imageDimension.

◆ Register()

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
template<typename TImageType1, typename TImageType2>
void itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >::Register ( MemberFunctionType pfunc,
TImageType1 * ,
TImageType2 *  )

Registers a specific member function.

Registers a member function templated over TImageType1 and TImageType2

◆ RegisterMemberFunctions() [1/4]

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
template<typename TPixelIDTypeList1, typename TPixelIDTypeList2, unsigned int VImageDimension, typename TAddressor>
void itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >::RegisterMemberFunctions ( )

Registers the member functions for all combinations of TPixelIDTypeList1 and PixelIDTypeList2.

With out the third template argument, the DualExecuteInternalAddressor will be used to instantiate "DualExecuteInternal" methods over the two image types referenced by all combination of type in the first list with types in the second.

The optional third template parameter provides a custom addressor.

Example usage:

this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList1,
PixelIDTypeList2, 3 > ();

or if a custom addressor is needed:

template < class TMemberFunctionPointer >
struct MyCustomAddressor
{
using ObjectType = typename ::detail::FunctionTraits<TMemberFunctionPointer>::ClassType;
template< typename TImageType1, typename TImageType2 >
TMemberFunctionPointer operator() ( void ) const
{
return &ObjectType::template CustomMethod< TImageType1, TImageType2 >;
}
};
this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList1,
PixelIDTypeList2,
3,
MyCustomAddressor<TMFP> > ();
typename ::detail::FunctionTraits< MemberFunctionType >::ClassType ObjectType

Referenced by RegisterMemberFunctions().

◆ RegisterMemberFunctions() [2/4]

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
template<typename TPixelIDTypeList1, typename TPixelIDTypeList2, unsigned int VImageDimension>
void itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >::RegisterMemberFunctions ( )
inline

Registers the member functions for all combinations of TPixelIDTypeList1 and PixelIDTypeList2.

With out the third template argument, the DualExecuteInternalAddressor will be used to instantiate "DualExecuteInternal" methods over the two image types referenced by all combination of type in the first list with types in the second.

The optional third template parameter provides a custom addressor.

Example usage:

this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList1,
PixelIDTypeList2, 3 > ();

or if a custom addressor is needed:

template < class TMemberFunctionPointer >
struct MyCustomAddressor
{
using ObjectType = typename ::detail::FunctionTraits<TMemberFunctionPointer>::ClassType;
template< typename TImageType1, typename TImageType2 >
TMemberFunctionPointer operator() ( void ) const
{
return &ObjectType::template CustomMethod< TImageType1, TImageType2 >;
}
};
this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList1,
PixelIDTypeList2,
3,
MyCustomAddressor<TMFP> > ();

Definition at line 134 of file sitkDualMemberFunctionFactory.h.

References RegisterMemberFunctions().

◆ RegisterMemberFunctions() [3/4]

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
template<typename TPixelIDTypeList, unsigned int VImageDimension, typename TAddressor>
void itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >::RegisterMemberFunctions ( )

Registers the member functions for all combinations of TPixelIDTypeList1 and PixelIDTypeList2.

With out the third template argument, the DualExecuteInternalAddressor will be used to instantiate "DualExecuteInternal" methods over the two image types referenced by all combination of type in the first list with types in the second.

The optional third template parameter provides a custom addressor.

Example usage:

this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList1,
PixelIDTypeList2, 3 > ();

or if a custom addressor is needed:

template < class TMemberFunctionPointer >
struct MyCustomAddressor
{
using ObjectType = typename ::detail::FunctionTraits<TMemberFunctionPointer>::ClassType;
template< typename TImageType1, typename TImageType2 >
TMemberFunctionPointer operator() ( void ) const
{
return &ObjectType::template CustomMethod< TImageType1, TImageType2 >;
}
};
this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList1,
PixelIDTypeList2,
3,
MyCustomAddressor<TMFP> > ();

◆ RegisterMemberFunctions() [4/4]

template<typename TMemberFunctionPointer, typename TContainer = std::unordered_map<std::tuple<unsigned int, int, unsigned int, int>, TMemberFunctionPointer, hash<std::tuple<unsigned int, int, unsigned int, int>>>>
template<typename TPixelIDTypeList, unsigned int VImageDimension>
void itk::simple::detail::DualMemberFunctionFactory< TMemberFunctionPointer, TContainer >::RegisterMemberFunctions ( )
inline

Registers the member functions for all combinations of TPixelIDTypeList1 and PixelIDTypeList2.

With out the third template argument, the DualExecuteInternalAddressor will be used to instantiate "DualExecuteInternal" methods over the two image types referenced by all combination of type in the first list with types in the second.

The optional third template parameter provides a custom addressor.

Example usage:

this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList1,
PixelIDTypeList2, 3 > ();

or if a custom addressor is needed:

template < class TMemberFunctionPointer >
struct MyCustomAddressor
{
using ObjectType = typename ::detail::FunctionTraits<TMemberFunctionPointer>::ClassType;
template< typename TImageType1, typename TImageType2 >
TMemberFunctionPointer operator() ( void ) const
{
return &ObjectType::template CustomMethod< TImageType1, TImageType2 >;
}
};
this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList1,
PixelIDTypeList2,
3,
MyCustomAddressor<TMFP> > ();

Definition at line 145 of file sitkDualMemberFunctionFactory.h.

References RegisterMemberFunctions().


The documentation for this class was generated from the following file: