19 #ifndef PAGESPEED_KERNEL_BASE_FUNCTION_H_
20 #define PAGESPEED_KERNEL_BASE_FUNCTION_H_
25 namespace net_instaweb {
67 return (quit_requested_ != NULL) && quit_requested_->value();
92 virtual void Run() = 0;
106 bool delete_after_callback_;
114 #define CALL_MEMBER_FN(object, ptrToMember) ((this->object)->*(ptrToMember))
131 typedef void (C::*Func)();
145 if (cancel_ != NULL) {
156 template<
class C,
typename T1>
159 typedef void (C::*Func)(T1);
173 if (cancel_ != NULL) {
185 template<
class C,
typename T1,
typename T2>
188 typedef void (C::*Func)(T1, T2);
198 run_(f), cancel_(cancel),
204 if (cancel_ != NULL) {
217 template<
class C,
typename T1,
typename T2,
typename T3>
220 typedef void (C::*Func)(T1, T2, T3);
230 C* c, T1 v1, T2 v2, T3 v3)
232 run_(f), cancel_(cancel),
233 v1_(v1), v2_(v2), v3_(v3) {}
238 if (cancel_ != NULL) {
252 template<
class C,
typename T1,
typename T2,
typename T3,
typename T4>
255 typedef void (C::*Func)(T1, T2, T3, T4);
265 C* c, T1 v1, T2 v2, T3 v3, T4 v4)
267 run_(f), cancel_(cancel),
268 v1_(v1), v2_(v2), v3_(v3), v4_(v4) {}
273 if (cancel_ != NULL) {
287 #undef CALL_MEMBER_FN
303 template<
class C,
class T>
310 template<
class C,
class T>
313 void (C::*cancel)(T), T t) {
318 template<
class C,
class T,
class U>
325 template<
class C,
class T,
class U>
327 void (C::*run)(T, U),
328 void (C::*cancel)(T, U),
334 template<
class C,
class T,
class U,
class V>
336 void (C::*run)(T, U, V),
343 template<
class C,
class T,
class U,
class V>
345 void (C::*run)(T, U, V),
346 void (C::*cancel)(T, U, V),
352 template<
class C,
class T,
class U,
class V,
class W>
354 void (C::*run)(T, U, V, W),
355 T t, U u, V v, W w) {
361 template<
class C,
class T,
class U,
class V,
class W>
363 void (C::*run)(T, U, V, W),
364 void (C::*cancel)(T, U, V, W),
365 T t, U u, V v, W w) {
366 return new MemberFunction4<C, T, U, V, W>(run, cancel, object, t, u, v, w);
bool quit_requested() const
Definition: function.h:66
Function * MakeFunction(C *object, void(C::*run)())
Makes a Function* that calls a 0-arg class method.
Definition: function.h:291
Captures a delayed call to a 2-arg member function as a closure.
Definition: function.h:186
Definition: atomic_bool.h:31
virtual void Run()
Definition: function.h:171
Captures a delayed call to a 4-arg member function as a closure.
Definition: function.h:253
virtual void Run()
Definition: function.h:202
MemberFunction3(Func f, C *c, T1 v1, T2 v2, T3 v3)
Constructor supplying a Run method, but no Cancel method.
Definition: function.h:223
virtual void Cancel()
Definition: function.h:272
virtual void Cancel()
Definition: function.h:237
MemberFunction0(Func f, C *c)
Constructor supplying a Run method, but no Cancel method.
Definition: function.h:134
Definition: function.h:47
Captures a delayed call to a 0-arg member function as a closure.
Definition: function.h:129
MemberFunction0(Func f, Func cancel, C *c)
Constructor supplying a Run method and a Cancel method.
Definition: function.h:139
virtual void Run()
Definition: function.h:143
virtual void Run()
Definition: function.h:236
MemberFunction3(Func f, Func cancel, C *c, T1 v1, T2 v2, T3 v3)
Constructor supplying a Run method and a Cancel method.
Definition: function.h:229
virtual void Cancel()
Definition: function.h:100
virtual void Cancel()
Definition: function.h:144
virtual void Cancel()
Definition: function.h:172
void set_delete_after_callback(bool x)
Definition: function.h:80
MemberFunction2(Func f, Func cancel, C *c, T1 v1, T2 v2)
Constructor supplying a Run method and a Cancel method.
Definition: function.h:195
Definition: function.h:119
MemberFunction2(Func f, C *c, T1 v1, T2 v2)
Constructor supplying a Run method, but no Cancel method.
Definition: function.h:191
Captures a delayed call to a 1-arg member function as a closure.
Definition: function.h:157
#define CALL_MEMBER_FN(object, ptrToMember)
Definition: function.h:114
virtual void Run()
Definition: function.h:271
Captures a delayed call to a 3-arg member function as a closure.
Definition: function.h:218
MemberFunction4(Func f, C *c, T1 v1, T2 v2, T3 v3, T4 v4)
Constructor supplying a Run method, but no Cancel method.
Definition: function.h:258
MemberFunction1(Func f, Func cancel, C *c, T1 v1)
Constructor supplying a Run method and a Cancel method.
Definition: function.h:166
MemberFunction1(Func f, C *c, T1 v1)
Constructor supplying a Run method, but no Cancel method.
Definition: function.h:162
void set_quit_requested_pointer(AtomicBool *x)
Definition: function.h:60
MemberFunction4(Func f, Func cancel, C *c, T1 v1, T2 v2, T3 v3, T4 v4)
Constructor supplying a Run method and a Cancel method.
Definition: function.h:264
virtual void Cancel()
Definition: function.h:203