SimpleITK  2.0.0rc2.post50
Public Types | Public Member Functions | Protected Attributes | List of all members
itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer > Class Template Reference

A class used to instantiate and generate function object to templated member functions. More...

#include <sitkMemberFunctionFactory.h>

+ Inheritance diagram for itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >:
+ Collaboration diagram for itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >:

Public Types

using FunctionObjectType = typename Superclass::FunctionObjectType
 
using MemberFunctionType = TMemberFunctionPointer
 
using ObjectType = typename ::detail::FunctionTraits< MemberFunctionType >::ClassType
 
using Self = MemberFunctionFactory
 
using Superclass = MemberFunctionFactoryBase< TMemberFunctionPointer, std::pair< unsigned int, int > >
 

Public Member Functions

FunctionObjectType GetMemberFunction (PixelIDValueType pixelID, unsigned int imageDimension)
 Returns a function object for the PixelIndex, and image dimension. More...
 
bool HasMemberFunction (PixelIDValueType pixelID, unsigned int imageDimension) const noexcept
 Query to determine if an member function has been registered for pixelID and imageDimension. More...
 
 MemberFunctionFactory (ObjectType *pObject)
 Constructor which permanently binds the constructed object to pObject. More...
 
template<typename TImageType >
void Register (MemberFunctionType pfunc, TImageType *)
 Registers a specific member function. More...
 
template<typename TPixelIDTypeList , unsigned int VImageDimension, typename TAddressor >
void RegisterMemberFunctions ()
 Registers all member functions in TPixelIDTypeList and simple::InstantiatedPixelIDTypeList over itk::Image<Pixel, ImageDimension> More...
 
template<typename TPixelIDTypeList , unsigned int VImageDimension>
void RegisterMemberFunctions ()
 Registers all member functions in TPixelIDTypeList and simple::InstantiatedPixelIDTypeList over itk::Image<Pixel, ImageDimension> More...
 
template<typename TPixelIDTypeList , unsigned int VImageDimension, unsigned int VImageDimensionStop>
void RegisterMemberFunctions ()
 Registers all member functions in TPixelIDTypeList and simple::InstantiatedPixelIDTypeList over itk::Image<Pixel, ImageDimension> More...
 
template<typename TPixelIDTypeList , unsigned int VImageDimension, unsigned int VImageDimensionStop, typename TAddressor >
std::enable_if<(VImageDimensionStop > VImageDimension)>::type RegisterMemberFunctions ()
 Registers all member functions in TPixelIDTypeList and simple::InstantiatedPixelIDTypeList over itk::Image<Pixel, ImageDimension> More...
 
template<typename TPixelIDTypeList , unsigned int VImageDimension, unsigned int VImageDimensionStop, typename TAddressor >
std::enable_if<(VImageDimensionStop==VImageDimension)>::type RegisterMemberFunctions ()
 Registers all member functions in TPixelIDTypeList and simple::InstantiatedPixelIDTypeList over itk::Image<Pixel, ImageDimension> More...
 

Protected Attributes

ObjectTypem_ObjectPointer
 

Detailed Description

template<typename TMemberFunctionPointer>
class itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >

A class used to instantiate and generate function object to templated member functions.

Template Parameters
TMemberFunctionPointeris the type of pointer to member function

Example member function pointer:

type alias Self& (Self::*MemberFunctionType)( Image* );

The RegisterMemberFunctions instantiate the templeted member functions and registers the member function pointer, so that it be used for dispatch later. Later they can be retrieve with the GetMemberFunction methods, which return 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.

Definition at line 55 of file sitkMemberFunctionFactory.h.

Member Typedef Documentation

◆ FunctionObjectType

template<typename TMemberFunctionPointer >
using itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >::FunctionObjectType = typename Superclass::FunctionObjectType

Definition at line 66 of file sitkMemberFunctionFactory.h.

◆ MemberFunctionType

template<typename TMemberFunctionPointer >
using itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >::MemberFunctionType = TMemberFunctionPointer

Definition at line 64 of file sitkMemberFunctionFactory.h.

◆ ObjectType

template<typename TMemberFunctionPointer >
using itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >::ObjectType = typename ::detail::FunctionTraits<MemberFunctionType>::ClassType

Definition at line 65 of file sitkMemberFunctionFactory.h.

◆ Self

template<typename TMemberFunctionPointer >
using itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >::Self = MemberFunctionFactory

Definition at line 62 of file sitkMemberFunctionFactory.h.

◆ Superclass

template<typename TMemberFunctionPointer >
using itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >::Superclass = MemberFunctionFactoryBase<TMemberFunctionPointer, std::pair<unsigned int, int> >

Definition at line 61 of file sitkMemberFunctionFactory.h.

Constructor & Destructor Documentation

◆ MemberFunctionFactory()

template<typename TMemberFunctionPointer >
itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >::MemberFunctionFactory ( ObjectType pObject)

Constructor which permanently binds the constructed object to pObject.

Member Function Documentation

◆ GetMemberFunction()

template<typename TMemberFunctionPointer >
FunctionObjectType itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >::GetMemberFunction ( PixelIDValueType  pixelID,
unsigned int  imageDimension 
)

Returns a function object for the PixelIndex, and image dimension.

pixelID 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, dimension )( 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 >
bool itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >::HasMemberFunction ( PixelIDValueType  pixelID,
unsigned int  imageDimension 
) const
noexcept

Query to determine if an member function has been registered for pixelID and imageDimension.

◆ Register()

template<typename TMemberFunctionPointer >
template<typename TImageType >
void itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >::Register ( MemberFunctionType  pfunc,
TImageType *   
)

Registers a specific member function.

Registers a member function which will be dispatched to the TImageType type

◆ RegisterMemberFunctions() [1/5]

template<typename TMemberFunctionPointer >
template<typename TPixelIDTypeList , unsigned int VImageDimension, typename TAddressor >
void itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >::RegisterMemberFunctions ( )

Registers all member functions in TPixelIDTypeList and simple::InstantiatedPixelIDTypeList over itk::Image<Pixel, ImageDimension>

Template Parameters
TAddressoris the type of a class who as a templated operator() which returns TMemberFunctionPointer, this will default to detail::MemberFunctionAddressor if not specified

Example usage:

template < class TMemberFunctionPointer >
struct AllocateAddressor
{
using ObjectType = typename ::detail::FunctionTraits<TMemberFunctionPointer>::ClassType;
template< typename TImageType >
TMemberFunctionPointer operator() ( void ) const
{
return &ObjectType::template AllocateInternal< TImageType >;
}
};
this->m_MemberFunctionFactory->RegisterMemberFunctions<PixelIDTypeList,
3,
AllocateAddressor<TMFP> > ();

Example usage:

this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > ();
this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2 > ();

A range can also be used:

this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2, 3 > ();

Referenced by itk::simple::detail::MemberFunctionFactory< MemberFunctionType >::RegisterMemberFunctions().

◆ RegisterMemberFunctions() [2/5]

template<typename TMemberFunctionPointer >
template<typename TPixelIDTypeList , unsigned int VImageDimension>
void itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >::RegisterMemberFunctions ( )
inline

Registers all member functions in TPixelIDTypeList and simple::InstantiatedPixelIDTypeList over itk::Image<Pixel, ImageDimension>

Template Parameters
TAddressoris the type of a class who as a templated operator() which returns TMemberFunctionPointer, this will default to detail::MemberFunctionAddressor if not specified

Example usage:

template < class TMemberFunctionPointer >
struct AllocateAddressor
{
using ObjectType = typename ::detail::FunctionTraits<TMemberFunctionPointer>::ClassType;
template< typename TImageType >
TMemberFunctionPointer operator() ( void ) const
{
return &ObjectType::template AllocateInternal< TImageType >;
}
};
this->m_MemberFunctionFactory->RegisterMemberFunctions<PixelIDTypeList,
3,
AllocateAddressor<TMFP> > ();

Example usage:

this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > ();
this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2 > ();

A range can also be used:

this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2, 3 > ();

Definition at line 125 of file sitkMemberFunctionFactory.h.

◆ RegisterMemberFunctions() [3/5]

template<typename TMemberFunctionPointer >
template<typename TPixelIDTypeList , unsigned int VImageDimension, unsigned int VImageDimensionStop>
void itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >::RegisterMemberFunctions ( )
inline

Registers all member functions in TPixelIDTypeList and simple::InstantiatedPixelIDTypeList over itk::Image<Pixel, ImageDimension>

Template Parameters
TAddressoris the type of a class who as a templated operator() which returns TMemberFunctionPointer, this will default to detail::MemberFunctionAddressor if not specified

Example usage:

template < class TMemberFunctionPointer >
struct AllocateAddressor
{
using ObjectType = typename ::detail::FunctionTraits<TMemberFunctionPointer>::ClassType;
template< typename TImageType >
TMemberFunctionPointer operator() ( void ) const
{
return &ObjectType::template AllocateInternal< TImageType >;
}
};
this->m_MemberFunctionFactory->RegisterMemberFunctions<PixelIDTypeList,
3,
AllocateAddressor<TMFP> > ();

Example usage:

this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > ();
this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2 > ();

A range can also be used:

this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2, 3 > ();

Definition at line 133 of file sitkMemberFunctionFactory.h.

◆ RegisterMemberFunctions() [4/5]

template<typename TMemberFunctionPointer >
template<typename TPixelIDTypeList , unsigned int VImageDimension, unsigned int VImageDimensionStop, typename TAddressor >
std::enable_if<(VImageDimensionStop > VImageDimension)>::type itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >::RegisterMemberFunctions ( )
inline

Registers all member functions in TPixelIDTypeList and simple::InstantiatedPixelIDTypeList over itk::Image<Pixel, ImageDimension>

Template Parameters
TAddressoris the type of a class who as a templated operator() which returns TMemberFunctionPointer, this will default to detail::MemberFunctionAddressor if not specified

Example usage:

template < class TMemberFunctionPointer >
struct AllocateAddressor
{
using ObjectType = typename ::detail::FunctionTraits<TMemberFunctionPointer>::ClassType;
template< typename TImageType >
TMemberFunctionPointer operator() ( void ) const
{
return &ObjectType::template AllocateInternal< TImageType >;
}
};
this->m_MemberFunctionFactory->RegisterMemberFunctions<PixelIDTypeList,
3,
AllocateAddressor<TMFP> > ();

Example usage:

this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > ();
this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2 > ();

A range can also be used:

this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2, 3 > ();

Definition at line 144 of file sitkMemberFunctionFactory.h.

◆ RegisterMemberFunctions() [5/5]

template<typename TMemberFunctionPointer >
template<typename TPixelIDTypeList , unsigned int VImageDimension, unsigned int VImageDimensionStop, typename TAddressor >
std::enable_if<(VImageDimensionStop == VImageDimension)>::type itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >::RegisterMemberFunctions ( )
inline

Registers all member functions in TPixelIDTypeList and simple::InstantiatedPixelIDTypeList over itk::Image<Pixel, ImageDimension>

Template Parameters
TAddressoris the type of a class who as a templated operator() which returns TMemberFunctionPointer, this will default to detail::MemberFunctionAddressor if not specified

Example usage:

template < class TMemberFunctionPointer >
struct AllocateAddressor
{
using ObjectType = typename ::detail::FunctionTraits<TMemberFunctionPointer>::ClassType;
template< typename TImageType >
TMemberFunctionPointer operator() ( void ) const
{
return &ObjectType::template AllocateInternal< TImageType >;
}
};
this->m_MemberFunctionFactory->RegisterMemberFunctions<PixelIDTypeList,
3,
AllocateAddressor<TMFP> > ();

Example usage:

this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 3 > ();
this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2 > ();

A range can also be used:

this->m_MemberFactory->RegisterMemberFunctions< PixelIDTypeList, 2, 3 > ();

Definition at line 154 of file sitkMemberFunctionFactory.h.

Member Data Documentation

◆ m_ObjectPointer

template<typename TMemberFunctionPointer >
ObjectType* itk::simple::detail::MemberFunctionFactory< TMemberFunctionPointer >::m_ObjectPointer
protected

Definition at line 188 of file sitkMemberFunctionFactory.h.


The documentation for this class was generated from the following file:
itk::simple::detail::MemberFunctionFactory::Self
MemberFunctionFactory Self
Definition: sitkMemberFunctionFactory.h:62
itk::simple::detail::MemberFunctionFactory::MemberFunctionType
TMemberFunctionPointer MemberFunctionType
Definition: sitkMemberFunctionFactory.h:64
itk::simple::detail::MemberFunctionFactory::ObjectType
typename ::detail::FunctionTraits< MemberFunctionType >::ClassType ObjectType
Definition: sitkMemberFunctionFactory.h:65
itk::simple::PixelIDValueType
int PixelIDValueType
Definition: sitkPixelIDValues.h:32