~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to src/base/AsyncJobCalls.h

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2009-09-24 14:51:06 UTC
  • mfrom: (1.1.12 upstream)
  • mto: (20.2.1 sid)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20090924145106-38jgrzmj0d73pha5
Tags: 3.1.0.13-1
* Upload to experimental

* New upstream release
  - Fixes Follow-X-Forwarded-For support (Closes: #523943)
  - Adds IPv6 support (Closes: #432351)

* debian/rules
  - Removed obsolete configuration options
  - Enable db and radius basic authentication modules

* debian/patches/01-cf.data.debian
  - Adapted to new upstream version

* debian/patches/02-makefile-defaults
  - Adapted to new upstream version

* debian/{squid.postinst,squid.rc,README.Debian,watch}
  - Updated references to squid 3.1

* debian/squid3.install
  - Install CSS file for error pages
  - Install manual pages for new authentication modules

* debian/squid3-common.install
  - Install documented version of configuration file in /usr/share/doc/squid3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*
 
3
 * $Id$
 
4
 */
 
5
 
 
6
#ifndef SQUID_ASYNCJOBCALLS_H
 
7
#define SQUID_ASYNCJOBCALLS_H
 
8
 
 
9
#include "base/AsyncJob.h"
 
10
 
 
11
/*
 
12
 * *MemFunT are member function (i.e., class method) wrappers. They store
 
13
 * details of a method call in an object so that the call can be delayed
 
14
 * and executed asynchronously.  Details may include the object pointer,
 
15
 * the handler method pointer, and parameters.  To simplify, we require
 
16
 * all handlers to return void and not be constant.
 
17
 */
 
18
 
 
19
/*
 
20
 * We need one wrapper for every supported member function arity (i.e.,
 
21
 * number of handler arguments). The first template parameter is the class
 
22
 * type of the handler. That class must be an AsyncJob child.
 
23
 */
 
24
 
 
25
// Arity names are from http://en.wikipedia.org/wiki/Arity
 
26
 
 
27
template <class C>
 
28
class NullaryMemFunT: public JobDialer
 
29
{
 
30
public:
 
31
    typedef void (C::*Method)();
 
32
    explicit NullaryMemFunT(C *anObject, Method aMethod):
 
33
            JobDialer(anObject), object(anObject), method(aMethod) {}
 
34
 
 
35
    virtual void print(std::ostream &os) const {  os << "()"; }
 
36
 
 
37
public:
 
38
    C *object;
 
39
    Method method;
 
40
 
 
41
protected:
 
42
    virtual void doDial() { (object->*method)(); }
 
43
};
 
44
 
 
45
template <class C, class Argument1>
 
46
class UnaryMemFunT: public JobDialer
 
47
{
 
48
public:
 
49
    typedef void (C::*Method)(Argument1);
 
50
    explicit UnaryMemFunT(C *anObject, Method aMethod, const Argument1 &anArg1):
 
51
            JobDialer(anObject),
 
52
            object(anObject), method(aMethod), arg1(anArg1) {}
 
53
 
 
54
    virtual void print(std::ostream &os) const {  os << '(' << arg1 << ')'; }
 
55
 
 
56
public:
 
57
    C *object;
 
58
    Method method;
 
59
    Argument1 arg1;
 
60
 
 
61
protected:
 
62
    virtual void doDial() { (object->*method)(arg1); }
 
63
};
 
64
 
 
65
// ... add more as needed
 
66
 
 
67
 
 
68
// Now we add global templated functions that create the member function
 
69
// wrappers above. These are for convenience: it is often easier to
 
70
// call a templated function than to create a templated object.
 
71
 
 
72
template <class C>
 
73
NullaryMemFunT<C>
 
74
MemFun(C *object, typename NullaryMemFunT<C>::Method method)
 
75
{
 
76
    return NullaryMemFunT<C>(object, method);
 
77
}
 
78
 
 
79
template <class C, class Argument1>
 
80
UnaryMemFunT<C, Argument1>
 
81
MemFun(C *object, typename UnaryMemFunT<C, Argument1>::Method method,
 
82
       Argument1 arg1)
 
83
{
 
84
    return UnaryMemFunT<C, Argument1>(object, method, arg1);
 
85
}
 
86
 
 
87
#endif /* SQUID_ASYNCJOBCALLS_H */