]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/base/AsyncJobCalls.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / base / AsyncJobCalls.h
index ef9a285f4ba5edc0a55a0e40a86e3e58ee2af6c5..07a572aa92063bba86785ac6958496cac788f418 100644 (file)
@@ -1,6 +1,9 @@
-
 /*
- * $Id$
+ * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
 #ifndef SQUID_ASYNCJOBCALLS_H
@@ -8,6 +11,7 @@
 
 #include "base/AsyncJob.h"
 #include "base/CbcPointer.h"
+#include "Debug.h"
 
 /**
  \ingroup AsyncJobAPI
@@ -50,7 +54,6 @@ CallJob(int debugSection, int debugLevel, const char *fileName, int fileLine,
     return ScheduleCall(fileName, fileLine, call);
 }
 
-
 #define CallJobHere(debugSection, debugLevel, job, Class, method) \
     CallJob((debugSection), (debugLevel), __FILE__, __LINE__, \
         (#Class "::" #method), \
@@ -59,15 +62,13 @@ CallJob(int debugSection, int debugLevel, const char *fileName, int fileLine,
 #define CallJobHere1(debugSection, debugLevel, job, Class, method, arg1) \
     CallJob((debugSection), (debugLevel), __FILE__, __LINE__, \
         (#Class "::" #method), \
-        JobMemFun<Class>((job), &Class::method, (arg1)))
-
+        JobMemFun((job), &Class::method, (arg1)))
 
 /// Convenience macro to create a Dialer-based job callback
 #define JobCallback(dbgSection, dbgLevel, Dialer, job, method) \
     asyncCall((dbgSection), (dbgLevel), #method, \
         Dialer(CbcPointer<Dialer::DestClass>(job), &method))
 
-
 /*
  * *MemFunT are member function (i.e., class method) wrappers. They store
  * details of a method call in an object so that the call can be delayed
@@ -90,7 +91,7 @@ class NullaryMemFunT: public JobDialer<Job>
 public:
     typedef void (Job::*Method)();
     explicit NullaryMemFunT(const CbcPointer<Job> &aJob, Method aMethod):
-            JobDialer<Job>(aJob), method(aMethod) {}
+        JobDialer<Job>(aJob), method(aMethod) {}
 
     virtual void print(std::ostream &os) const {  os << "()"; }
 
@@ -101,20 +102,20 @@ protected:
     virtual void doDial() { ((&(*this->job))->*method)(); }
 };
 
-template <class Job, class Argument1>
+template <class Job, class Data, class Argument1 = Data>
 class UnaryMemFunT: public JobDialer<Job>
 {
 public:
     typedef void (Job::*Method)(Argument1);
     explicit UnaryMemFunT(const CbcPointer<Job> &aJob, Method aMethod,
-                          const Argument1 &anArg1): JobDialer<Job>(aJob),
-            method(aMethod), arg1(anArg1) {}
+                          const Data &anArg1): JobDialer<Job>(aJob),
+        method(aMethod), arg1(anArg1) {}
 
     virtual void print(std::ostream &os) const {  os << '(' << arg1 << ')'; }
 
 public:
     Method method;
-    Argument1 arg1;
+    Data arg1;
 
 protected:
     virtual void doDial() { ((&(*this->job))->*method)(arg1); }
@@ -122,7 +123,6 @@ protected:
 
 // ... add more as needed
 
-
 // Now we add global templated functions that create the member function
 // wrappers above. These are for convenience: it is often easier to
 // call a templated function than to create a templated object.
@@ -142,7 +142,6 @@ JobMemFun(const CbcPointer<C> &job, typename UnaryMemFunT<C, Argument1>::Method
     return UnaryMemFunT<C, Argument1>(job, method, arg1);
 }
 
-
 // inlined methods
 
 template<class Job>
@@ -183,3 +182,4 @@ JobDialer<Job>::dial(AsyncCall &call)
 }
 
 #endif /* SQUID_ASYNCJOBCALLS_H */
+