Squid Web Cache
master
Loading...
Searching...
No Matches
Subscription.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1996-2025 The Squid Software Foundation and contributors
3
*
4
* Squid software is distributed under GPLv2+ license and includes
5
* contributions from numerous individuals and organizations.
6
* Please see the COPYING and CONTRIBUTORS files for details.
7
*/
8
9
#ifndef SQUID_SRC_BASE_SUBSCRIPTION_H
10
#define SQUID_SRC_BASE_SUBSCRIPTION_H
11
12
#include "
base/AsyncCall.h
"
13
25
class
Subscription
:
public
RefCountable
26
{
27
public
:
28
typedef
RefCount<Subscription>
Pointer
;
29
34
virtual
AsyncCall::Pointer
callback
()
const
= 0;
35
};
36
47
template
<
class
Call_>
48
class
CallSubscription
:
public
Subscription
49
{
50
public
:
52
explicit
CallSubscription
(
const
RefCount<Call_>
&aCall) :
call
(aCall) {
assert
(aCall !=
nullptr
); }
53
AsyncCall::Pointer
callback
()
const override
54
{
55
const
AsyncCall::Pointer
cb =
new
Call_(*
call
);
56
if
(!cb->
codeContext
||
CodeContext::Current
())
57
cb->
codeContext
=
CodeContext::Current
();
58
return
cb;
59
}
60
61
private
:
62
const
RefCount<Call_>
call
;
63
};
64
65
#endif
/* SQUID_SRC_BASE_SUBSCRIPTION_H */
66
AsyncCall.h
RefCountable
#define RefCountable
The locking interface for use on Reference-Counted classes.
Definition
Lock.h:66
assert
#define assert(EX)
Definition
assert.h:17
AsyncCall::codeContext
CodeContext::Pointer codeContext
what the callee is expected to work on
Definition
AsyncCall.h:74
CallSubscription
Definition
Subscription.h:49
CallSubscription::CallSubscription
CallSubscription(const RefCount< Call_ > &aCall)
Must be passed an object. nil pointers are not permitted.
Definition
Subscription.h:52
CallSubscription::call
const RefCount< Call_ > call
gets copied to create callback calls
Definition
Subscription.h:62
CallSubscription::callback
AsyncCall::Pointer callback() const override
Definition
Subscription.h:53
CodeContext::Current
static const Pointer & Current()
Definition
CodeContext.cc:33
RefCount
Definition
RefCount.h:28
Subscription
Definition
Subscription.h:26
Subscription::Pointer
RefCount< Subscription > Pointer
Definition
Subscription.h:28
Subscription::callback
virtual AsyncCall::Pointer callback() const =0
squid
src
base
Subscription.h
Generated by
1.9.8