14 #ifndef __UT_Functor_C__
15 #define __UT_Functor_C__
26 if (myFunctorImpl.myFunctorImpl)
27 (*myFunctorImpl.myFunctorImpl)();
35 template <
typename Po
interToObj,
typename Po
interToMemFn>
43 const PointerToMemFn pointer_to_mem_fn)
44 : myPointerToObj(pointer_to_obj), myPointerToMemFn(pointer_to_mem_fn)
49 PointerToMemFn>(*this); }
53 { ((*myPointerToObj).*myPointerToMemFn)(); }
56 PointerToObj myPointerToObj;
57 PointerToMemFn myPointerToMemFn;
62 template <
typename P1,
typename Po
interToObj,
typename Po
interToMemFn>
71 const PointerToMemFn pointer_to_mem_fn)
72 : myPointerToObj(pointer_to_obj), myPointerToMemFn(pointer_to_mem_fn)
77 PointerToMemFn>(*this); }
81 { ((*myPointerToObj).*myPointerToMemFn)(parm1); }
85 int64 mem = inclusive ?
sizeof(*this) : 0;
90 PointerToObj myPointerToObj;
91 PointerToMemFn myPointerToMemFn;
96 template <
typename P1,
typename P2,
97 typename PointerToObj,
typename PointerToMemFn>
107 const PointerToMemFn pointer_to_mem_fn)
108 : myPointerToObj(pointer_to_obj), myPointerToMemFn(pointer_to_mem_fn)
113 PointerToMemFn>(*this); }
117 { ((*myPointerToObj).*myPointerToMemFn)(parm1, parm2); }
120 PointerToObj myPointerToObj;
121 PointerToMemFn myPointerToMemFn;
124 template <
typename P1>
136 : myFunctorImpl(functor_implementation)
141 myFunctorImpl.myFunctorImpl = src.myFunctorImpl.myFunctorImpl
142 ? src.myFunctorImpl.myFunctorImpl->clone() :
nullptr;
145 template <
typename FunctorType>
150 template <
typename Po
interToObj,
typename Po
interToMemFn>
153 PointerToMemFn>(pointer, method))
158 delete myFunctorImpl.myFunctorImpl;
159 myFunctorImpl.myFunctorImpl = 0;
164 if (&functor !=
this)
166 delete myFunctorImpl.myFunctorImpl;
167 myFunctorImpl.myFunctorImpl = functor.myFunctorImpl.myFunctorImpl
168 ? functor.myFunctorImpl.myFunctorImpl->clone() : 0;
177 (*myFunctorImpl.myFunctorImpl)(parm1);
181 {
return myFunctorImpl.myFunctorImpl != 0; }
185 int64 mem = inclusive ?
sizeof(*this) : 0;
186 if (myFunctorImpl.myFunctorImpl)
187 mem += myFunctorImpl.myFunctorImpl->getMemoryUsage(
true);
195 Helper() : myFunctorImpl(0) {}
198 Helper(
const Helper &helper)
199 { myFunctorImpl = helper.myFunctorImpl
200 ? helper.myFunctorImpl->clone() : 0; }
204 : myFunctorImpl(functor_implementation) {}
207 explicit Helper(U *
ptr) : myFunctorImpl(ptr) {}
212 Helper myFunctorImpl;
217 template <
typename P1,
typename P2>
230 : myFunctorImpl(functor_impl)
235 myFunctorImpl.myFunctorImpl = src.myFunctorImpl.myFunctorImpl
236 ? src.myFunctorImpl.myFunctorImpl->clone() :
nullptr;
239 template <
typename FunctorType>
244 template <
typename Po
interToObj,
typename Po
interToMemFn>
247 PointerToMemFn>(pointer, method))
252 delete myFunctorImpl.myFunctorImpl;
253 myFunctorImpl.myFunctorImpl = 0;
258 if (&functor !=
this)
260 delete myFunctorImpl.myFunctorImpl;
261 myFunctorImpl.myFunctorImpl = functor.myFunctorImpl.myFunctorImpl
262 ? functor.myFunctorImpl.myFunctorImpl->clone() : 0;
271 (*myFunctorImpl.myFunctorImpl)(parm1, parm2);
275 {
return myFunctorImpl.myFunctorImpl != 0; }
281 Helper() : myFunctorImpl(0) {}
284 Helper(
const Helper &helper)
285 { myFunctorImpl = helper.myFunctorImpl
286 ? helper.myFunctorImpl->clone() : 0; }
290 : myFunctorImpl(functor_impl) {}
293 explicit Helper(U *
ptr) : myFunctorImpl(ptr) {}
298 Helper myFunctorImpl;
UT_Functor2(FunctorType functor)
void operator()(Parm1Type parm1, Parm2Type parm2) const override
UT_Functor1(FunctorType functor)
UT_MemFunHandler1(const PointerToObj &pointer_to_obj, const PointerToMemFn pointer_to_mem_fn)
UT_Functor2(const PointerToObj &pointer, PointerToMemFn method)
UT_Functor2(UT_FunctorImpl2< void, Parm1Type, Parm2Type > *functor_impl)
UT_Functor2 & operator=(const UT_Functor2 &functor)
int64 getMemoryUsage(bool inclusive) const override
UT_Functor1(const PointerToObj &pointer, PointerToMemFn method)
UT_Functor1(UT_FunctorImpl1< void, Parm1Type > *functor_implementation)
void operator()(Parm1Type parm1) const override
UT_MemFunHandler(const PointerToObj &pointer_to_obj, const PointerToMemFn pointer_to_mem_fn)
UT_FunctorImpl1< void, P1 > * clone() const override
void operator()() const override
UT_Functor1(const this_type &src)
UT_FunctorImpl< void > * clone() const override
UT_Functor2(const this_type &src)
void operator()(Parm1Type parm1, Parm2Type parm2) const
void operator()(Parm1Type parm1) const
int64 getMemoryUsage(bool inclusive) const
UT_MemFunHandler2(const PointerToObj &pointer_to_obj, const PointerToMemFn pointer_to_mem_fn)
UT_FunctorImpl2< void, Parm1Type, Parm2Type > * clone() const override
UT_Functor1 & operator=(const UT_Functor1 &functor)
ReturnType operator()() const