18 #ifndef sitkMemberFunctionFactoryBase_h
19 #define sitkMemberFunctionFactoryBase_h
30 #include "Ancillary/TypeList.h"
31 #include "Ancillary/FunctionTraits.h"
33 #if defined SITK_HAS_UNORDERED_MAP
48 #if defined SITK_HAS_UNORDERED_MAP
50 template <
typename T>
struct hash :
public nsstd::hash<T>{};
55 struct hash<
std::pair<int, int> >
56 :
public std::unary_function<std::pair<int,int>, std::size_t> {
57 std::size_t operator()(
const std::pair<int, int > &p )
const
58 {
return nsstd::hash<size_t>()(
size_t(p.first) * prime + p.second ); }
60 static const std::size_t prime = 16777619u;
64 template<
typename TMemberFunctionPointer,
66 unsigned int TArity = ::detail::FunctionTraits<TMemberFunctionPointer>::arity>
76 template<
typename TMemberFunctionPo
inter,
typename TKey>
83 typedef typename ::detail::FunctionTraits<MemberFunctionType>::ClassType
ObjectType;
88 #if defined SITK_HAS_UNORDERED_MAP
89 : m_PFunction4( typelist::Length<InstantiatedPixelIDTypeList>::Result ),
90 m_PFunction3( typelist::Length<InstantiatedPixelIDTypeList>::Result ),
91 m_PFunction2( typelist::Length<InstantiatedPixelIDTypeList>::Result )
110 static FunctionObjectType
BindObject( MemberFunctionType pfunc, ObjectType *objectPointer)
116 return nsstd::bind( pfunc,objectPointer );
120 #if defined SITK_HAS_UNORDERED_MAP
121 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction4;
122 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction3;
123 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction2;
139 template<
typename TMemberFunctionPo
inter,
typename TKey>
146 typedef typename ::detail::FunctionTraits<MemberFunctionType>::ClassType
ObjectType;
152 #if defined SITK_HAS_UNORDERED_MAP
153 : m_PFunction4( typelist::Length<InstantiatedPixelIDTypeList>::Result ),
154 m_PFunction3( typelist::Length<InstantiatedPixelIDTypeList>::Result ),
155 m_PFunction2( typelist::Length<InstantiatedPixelIDTypeList>::Result )
163 typedef nsstd::function< MemberFunctionResultType ( MemberFunctionArgumentType ) >
FunctionObjectType;
174 static FunctionObjectType
BindObject( MemberFunctionType pfunc, ObjectType *objectPointer)
177 using namespace nsstd::placeholders;
182 return nsstd::bind( pfunc,objectPointer, _1 );
187 #if defined SITK_HAS_UNORDERED_MAP
188 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction4;
189 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction3;
190 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction2;
201 template<
typename TMemberFunctionPo
inter,
typename TKey>
211 typedef typename ::detail::FunctionTraits<MemberFunctionType>::ClassType
ObjectType;
215 #if defined SITK_HAS_UNORDERED_MAP
216 : m_PFunction4( typelist::Length<InstantiatedPixelIDTypeList>::Result ),
217 m_PFunction3( typelist::Length<InstantiatedPixelIDTypeList>::Result ),
218 m_PFunction2( typelist::Length<InstantiatedPixelIDTypeList>::Result )
227 typedef nsstd::function< MemberFunctionResultType ( MemberFunctionArgument0Type, MemberFunctionArgument1Type) >
FunctionObjectType;
238 static FunctionObjectType
BindObject( MemberFunctionType pfunc, ObjectType *objectPointer)
241 using namespace nsstd::placeholders;
246 return nsstd::bind( pfunc, objectPointer, _1, _2 );
251 #if defined SITK_HAS_UNORDERED_MAP
252 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction4;
253 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction3;
254 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction2;
265 template<
typename TMemberFunctionPo
inter,
typename TKey>
276 typedef typename ::detail::FunctionTraits<MemberFunctionType>::ClassType
ObjectType;
280 #if defined SITK_HAS_UNORDERED_MAP
281 : m_PFunction4( typelist::Length<InstantiatedPixelIDTypeList>::Result ),
282 m_PFunction3( typelist::Length<InstantiatedPixelIDTypeList>::Result ),
283 m_PFunction2( typelist::Length<InstantiatedPixelIDTypeList>::Result )
291 typedef nsstd::function< MemberFunctionResultType ( MemberFunctionArgument0Type, MemberFunctionArgument1Type, MemberFunctionArgument2Type) >
FunctionObjectType;
302 static FunctionObjectType
BindObject( MemberFunctionType pfunc, ObjectType *objectPointer)
305 using namespace nsstd::placeholders;
310 return nsstd::bind( pfunc, objectPointer, _1, _2, _3 );
315 #if defined SITK_HAS_UNORDERED_MAP
316 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction4;
317 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction3;
318 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction2;
328 template<
typename TMemberFunctionPo
inter,
typename TKey>
340 typedef typename ::detail::FunctionTraits<MemberFunctionType>::ClassType
ObjectType;
344 #if defined SITK_HAS_UNORDERED_MAP
345 : m_PFunction4( typelist::Length<InstantiatedPixelIDTypeList>::Result ),
346 m_PFunction3( typelist::Length<InstantiatedPixelIDTypeList>::Result ),
347 m_PFunction2( typelist::Length<InstantiatedPixelIDTypeList>::Result )
355 typedef nsstd::function< MemberFunctionResultType ( MemberFunctionArgument0Type, MemberFunctionArgument1Type, MemberFunctionArgument2Type, MemberFunctionArgument3Type) >
FunctionObjectType;
366 static FunctionObjectType
BindObject( MemberFunctionType pfunc, ObjectType *objectPointer)
369 using namespace nsstd::placeholders;
374 return nsstd::bind( pfunc, objectPointer, _1, _2, _3, _4 );
379 #if defined SITK_HAS_UNORDERED_MAP
380 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction4;
381 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction3;
382 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction2;
391 template<
typename TMemberFunctionPo
inter,
typename TKey>
404 typedef typename ::detail::FunctionTraits<MemberFunctionType>::ClassType
ObjectType;
408 #if defined SITK_HAS_UNORDERED_MAP
409 : m_PFunction4( typelist::Length<InstantiatedPixelIDTypeList>::Result ),
410 m_PFunction3( typelist::Length<InstantiatedPixelIDTypeList>::Result ),
411 m_PFunction2( typelist::Length<InstantiatedPixelIDTypeList>::Result )
419 typedef nsstd::function< MemberFunctionResultType (
420 MemberFunctionArgument0Type,
421 MemberFunctionArgument1Type,
422 MemberFunctionArgument2Type,
423 MemberFunctionArgument3Type,
424 MemberFunctionArgument4Type ) >
439 using namespace nsstd::placeholders;
444 return nsstd::bind( pfunc, objectPointer, _1, _2, _3, _4, _5 );
449 #if defined SITK_HAS_UNORDERED_MAP
450 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction4;
451 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction3;
452 nsstd::unordered_map< TKey, FunctionObjectType, hash<TKey> > m_PFunction2;
465 #endif // sitkMemberFunctionFactoryBase_h
nsstd::function< MemberFunctionResultType(MemberFunctionArgument0Type, MemberFunctionArgument1Type, MemberFunctionArgument2Type, MemberFunctionArgument3Type, MemberFunctionArgument4Type) > FunctionObjectType
::detail::FunctionTraits< MemberFunctionType >::Argument0Type MemberFunctionArgument0Type
static FunctionObjectType BindObject(MemberFunctionType pfunc, ObjectType *objectPointer)
std::map< TKey, FunctionObjectType > m_PFunction4
std::map< TKey, FunctionObjectType > m_PFunction3
::detail::FunctionTraits< MemberFunctionType >::ClassType ObjectType
TMemberFunctionPointer MemberFunctionType
static FunctionObjectType BindObject(MemberFunctionType pfunc, ObjectType *objectPointer)
std::map< TKey, FunctionObjectType > m_PFunction3
MemberFunctionFactoryBase(void)
std::map< TKey, FunctionObjectType > m_PFunction4
std::map< TKey, FunctionObjectType > m_PFunction3
std::map< TKey, FunctionObjectType > m_PFunction2
::detail::FunctionTraits< MemberFunctionType >::Argument0Type MemberFunctionArgumentType
TMemberFunctionPointer MemberFunctionType
::detail::FunctionTraits< MemberFunctionType >::Argument0Type MemberFunctionArgument0Type
MemberFunctionFactoryBase(void)
std::map< TKey, FunctionObjectType > m_PFunction4
::detail::FunctionTraits< MemberFunctionType >::Argument1Type MemberFunctionArgument1Type
::detail::FunctionTraits< MemberFunctionType >::Argument1Type MemberFunctionArgument1Type
::detail::FunctionTraits< MemberFunctionType >::ResultType MemberFunctionResultType
nsstd::function< MemberFunctionResultType() > FunctionObjectType
::detail::FunctionTraits< MemberFunctionType >::ResultType MemberFunctionResultType
::detail::FunctionTraits< MemberFunctionType >::Argument2Type MemberFunctionArgument2Type
nsstd::function< MemberFunctionResultType(MemberFunctionArgument0Type, MemberFunctionArgument1Type, MemberFunctionArgument2Type) > FunctionObjectType
static FunctionObjectType BindObject(MemberFunctionType pfunc, ObjectType *objectPointer)
::detail::FunctionTraits< MemberFunctionType >::Argument3Type MemberFunctionArgument3Type
std::map< TKey, FunctionObjectType > m_PFunction2
::detail::FunctionTraits< MemberFunctionType >::Argument1Type MemberFunctionArgument1Type
static FunctionObjectType BindObject(MemberFunctionType pfunc, ObjectType *objectPointer)
MemberFunctionFactoryBase(void)
std::map< TKey, FunctionObjectType > m_PFunction2
nsstd::function< MemberFunctionResultType(MemberFunctionArgumentType) > FunctionObjectType
::detail::FunctionTraits< MemberFunctionType >::ResultType MemberFunctionResultType
::detail::FunctionTraits< MemberFunctionType >::ClassType ObjectType
::detail::FunctionTraits< MemberFunctionType >::ClassType ObjectType
std::map< TKey, FunctionObjectType > m_PFunction3
::detail::FunctionTraits< MemberFunctionType >::ResultType MemberFunctionResultType
::detail::FunctionTraits< MemberFunctionType >::ClassType ObjectType
nsstd::function< MemberFunctionResultType(MemberFunctionArgument0Type, MemberFunctionArgument1Type) > FunctionObjectType
TMemberFunctionPointer MemberFunctionType
std::map< TKey, FunctionObjectType > m_PFunction2
::detail::FunctionTraits< MemberFunctionType >::ClassType ObjectType
std::map< TKey, FunctionObjectType > m_PFunction3
std::map< TKey, FunctionObjectType > m_PFunction4
::detail::FunctionTraits< MemberFunctionType >::Argument0Type MemberFunctionArgument0Type
TMemberFunctionPointer MemberFunctionType
::detail::FunctionTraits< MemberFunctionType >::Argument3Type MemberFunctionArgument3Type
MemberFunctionFactoryBase(void)
A base class for the MemberFunctionFactory.
::detail::FunctionTraits< MemberFunctionType >::ClassType ObjectType
MemberFunctionFactoryBase(void)
std::map< TKey, FunctionObjectType > m_PFunction4
::detail::FunctionTraits< MemberFunctionType >::Argument2Type MemberFunctionArgument2Type
static FunctionObjectType BindObject(MemberFunctionType pfunc, ObjectType *objectPointer)
::detail::FunctionTraits< MemberFunctionType >::ResultType MemberFunctionResultType
std::map< TKey, FunctionObjectType > m_PFunction2
std::map< TKey, FunctionObjectType > m_PFunction3
nsstd::function< MemberFunctionResultType(MemberFunctionArgument0Type, MemberFunctionArgument1Type, MemberFunctionArgument2Type, MemberFunctionArgument3Type) > FunctionObjectType
::detail::FunctionTraits< MemberFunctionType >::Argument4Type MemberFunctionArgument4Type
TMemberFunctionPointer MemberFunctionType
An inheratable class to disable copying of a class.
::detail::FunctionTraits< MemberFunctionType >::Argument1Type MemberFunctionArgument1Type
std::map< TKey, FunctionObjectType > m_PFunction4
static FunctionObjectType BindObject(MemberFunctionType pfunc, ObjectType *objectPointer)
::detail::FunctionTraits< MemberFunctionType >::Argument0Type MemberFunctionArgument0Type
std::map< TKey, FunctionObjectType > m_PFunction2
MemberFunctionFactoryBase(void)
::detail::FunctionTraits< MemberFunctionType >::ResultType MemberFunctionResultType
TMemberFunctionPointer MemberFunctionType
::detail::FunctionTraits< MemberFunctionType >::Argument2Type MemberFunctionArgument2Type