6 #ifndef __objfunctor_h__
7 #define __objfunctor_h__
38 U* pClone =
static_cast<U*
>(pObj->DoClone());
39 assert(
typeid(*pClone) ==
typeid(*pObj));
50 #define DEFINE_CLONE_FUNCTORIMPL(Cls) \
51 virtual Cls* DoClone() const { return new Cls(*this); }
62 template <
typename R,
class TList>
84 template <
typename R,
typename P1>
99 template <
typename R,
typename P1,
typename P2>
115 template <
typename R,
typename P1,
typename P2,
typename P3>
132 template <
typename R,
typename P1,
typename P2,
typename P3,
typename P4>
150 template <
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
171 template <
class ParentFunctor,
typename Fun>
173 :
public ParentFunctor::Impl
175 typedef typename ParentFunctor::Impl
Base;
198 {
return f_(p1, p2); }
201 {
return f_(p1, p2, p3); }
204 {
return f_(p1, p2, p3, p4); }
207 {
return f_(p1, p2, p3, p4, p5); }
218 template <
class ParentFunctor,
typename PointerToObj,
219 typename PointerToMemFn>
222 typedef typename ParentFunctor::Impl
Base;
239 {
return ((*pObj_).*
pMemFn_)(); }
242 {
return ((*pObj_).*
pMemFn_)(p1); }
245 {
return ((*pObj_).*
pMemFn_)(p1, p2); }
248 {
return ((*pObj_).*
pMemFn_)(p1, p2, p3); }
251 {
return ((*pObj_).*
pMemFn_)(p1, p2, p3, p4); }
254 {
return ((*pObj_).*
pMemFn_)(p1, p2, p3, p4, p5); }
266 template <
typename R,
class TList = NullType>
291 template <
typename Fun>
296 template <
class PtrObj,
typename MemFn>
321 {
return (*
spImpl_)(p1, p2, p3); }
324 {
return (*
spImpl_)(p1, p2, p3, p4); }
327 {
return (*
spImpl_)(p1, p2, p3, p4, p5); }
337 template <
typename R,
class TList>
353 template <
class OriginalFunctor>
362 typedef typename OriginalFunctor::Parm2
Parm1;
363 typedef typename OriginalFunctor::Parm3
Parm2;
364 typedef typename OriginalFunctor::Parm4
Parm3;
365 typedef typename OriginalFunctor::Parm5
Parm4;
381 {
return f_(
b_, p1); }
384 {
return f_(
b_, p1, p2); }
387 {
return f_(
b_, p1, p2, p3); }
390 {
return f_(
b_, p1, p2, p3, p4); }
402 template <
class Fctor>
406 typename Fctor::Parm1 bound)
411 return Outgoing(std::auto_ptr<typename Outgoing::Impl>(
420 template <
typename Fun1,
typename Fun2>
443 {
return f1_(p1),
f2_(p1); }
446 {
return f1_(p1, p2),
f2_(p1, p2); }
449 {
return f1_(p1, p2, p3),
f2_(p1, p2, p3); }
452 {
return f1_(p1, p2, p3, p4),
f2_(p1, p2, p3, p4); }
455 {
return f1_(p1, p2, p3, p4, p5),
f2_(p1, p2, p3, p4, p5); }
468 template <
class Fun1,
class Fun2>
473 return Fun2(std::auto_ptr<typename Fun2::Impl>(
ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3)
OriginalFunctor::ResultType ResultType
OriginalFunctor::Parm3 Parm2
OriginalFunctor::Parm1 BoundType
OriginalFunctor::Parm5 Parm4
ResultType operator()(Parm1 p1)
ResultType operator()(Parm1 p1, Parm2 p2)
Private::BinderFirstTraits< OriginalFunctor >::Impl Base
BinderFirst(const OriginalFunctor &fun, BoundType bound)
OriginalFunctor::Parm4 Parm3
OriginalFunctor::Parm2 Parm1
ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4)
ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3)
ResultType operator()(Parm1 p1, Parm2 p2)
Base::ResultType ResultType
ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4)
Chainer(const Fun1 &fun1, const Fun2 &fun2)
ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5)
ResultType operator()(Parm1 p1)
ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5)
ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3)
ResultType operator()(Parm1 p1)
Base::ResultType ResultType
ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4)
ResultType operator()(Parm1 p1, Parm2 p2)
FunctorHandler(const Fun &fun)
virtual R operator()(Parm1)=0
TypeTraits< P1 >::ParameterType Parm1
virtual R operator()(Parm1, Parm2)=0
TypeTraits< P1 >::ParameterType Parm1
TypeTraits< P2 >::ParameterType Parm2
TypeTraits< P2 >::ParameterType Parm2
virtual R operator()(Parm1, Parm2, Parm3)=0
TypeTraits< P3 >::ParameterType Parm3
TypeTraits< P1 >::ParameterType Parm1
TypeTraits< P1 >::ParameterType Parm1
TypeTraits< P3 >::ParameterType Parm3
TypeTraits< P4 >::ParameterType Parm4
virtual R operator()(Parm1, Parm2, Parm3, Parm4)=0
TypeTraits< P2 >::ParameterType Parm2
virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5)=0
TypeTraits< P5 >::ParameterType Parm5
TypeTraits< P1 >::ParameterType Parm1
TypeTraits< P4 >::ParameterType Parm4
TypeTraits< P2 >::ParameterType Parm2
TypeTraits< P3 >::ParameterType Parm3
ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4)
MemFunHandler(const PointerToObj &pObj, PointerToMemFn pMemFn)
ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3)
ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5)
Base::ResultType ResultType
ResultType operator()(Parm1 p1, Parm2 p2)
ResultType operator()(Parm1 p1)
FunctorImpl< R, TList > Impl
ObjectFunctor(const PtrObj &p, MemFn memFn)
ObjectFunctor & operator=(const ObjectFunctor &rhs)
ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3)
ResultType operator()(Parm1 p1)
ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4)
std::auto_ptr< Impl > spImpl_
ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5)
ObjectFunctor(const ObjectFunctor &rhs)
ResultType operator()(Parm1 p1, Parm2 p2)
ObjectFunctor(std::auto_ptr< Impl > spImpl)
Select< isStdArith||isPointer||isMemberPointer, T, ReferredType & >::Result ParameterType
void get(multi1d< LatticeColorMatrix > &u, XMLBufferWriter &file_xml, XMLBufferWriter &record_xml)
Get the default gauge field.
Asqtad Staggered-Dirac operator.
Fun2 Chain(const Fun1 &fun1, const Fun2 &fun2)
Private::BinderFirstTraits< Fctor >::BoundFunctorType BindFirst(const Fctor &fun, typename Fctor::Parm1 bound)
#define DEFINE_CLONE_FUNCTORIMPL(Cls)
TL::Erase< TList, typename TL::TypeAt< TList, 0 >::Result >::Result ParmList
ObjectFunctor< R, ParmList > BoundFunctorType
BoundFunctorType::Impl Impl
virtual FunctorImplBase * DoClone() const =0
static U * Clone(U *pObj)
multi1d< LatticeColorMatrix > U
#define TYPELIST_3(T1, T2, T3)
#define TYPELIST_2(T1, T2)
#define TYPELIST_4(T1, T2, T3, T4)
#define TYPELIST_5(T1, T2, T3, T4, T5)