Subscription.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2020 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_BASE_SUBSCRIPTION_H
10 #define _SQUID_BASE_SUBSCRIPTION_H
11 
12 #include "base/AsyncCall.h"
13 
26 {
27 public:
29 
34  virtual AsyncCall::Pointer callback() const = 0;
35 };
36 
47 template<class Call_>
49 {
50 public:
52  explicit CallSubscription(const RefCount<Call_> &aCall) : call(aCall) { assert(aCall != NULL); }
53  virtual AsyncCall::Pointer callback() const
54  {
55  const AsyncCall::Pointer cb = new Call_(*call);
56  if (!cb->codeContext || CodeContext::Current())
58  return cb;
59  }
60 
61 private:
63 };
64 
65 #endif /* _SQUID_BASE_SUBSCRIPTION_H */
66 
CodeContext::Pointer codeContext
what the callee is expected to work on
Definition: AsyncCall.h:75
virtual AsyncCall::Pointer callback() const =0
#define NULL
Definition: types.h:166
RefCount< Subscription > Pointer
Definition: Subscription.h:28
#define assert(EX)
Definition: assert.h:19
CallSubscription(const RefCount< Call_ > &aCall)
Must be passed an object. nil pointers are not permitted.
Definition: Subscription.h:52
const RefCount< Call_ > call
gets copied to create callback calls
Definition: Subscription.h:62
static const Pointer & Current()
Definition: CodeContext.cc:33
virtual AsyncCall::Pointer callback() const
Definition: Subscription.h:53

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors