AsyncCbdataCalls.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 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_ASYNCCBDATACALLS_H
10#define SQUID_BASE_ASYNCCBDATACALLS_H
11
12#include "base/AsyncCall.h"
13#include "base/CbcPointer.h"
14
15// dialer to run cbdata callback functions as Async Calls
16// to ease the transition of these cbdata objects to full Jobs
17template<class Argument1>
19{
20public:
21 typedef void Handler(Argument1 *);
22
24 arg1(aArg),
25 handler(aHandler)
26 {}
27
28 virtual bool canDial(AsyncCall &) { return arg1.valid(); }
29 void dial(AsyncCall &) { handler(arg1.get()); }
30 void print(std::ostream &os) const override { os << '(' << arg1 << ')'; }
31
32public:
35};
36
37// helper function to simplify Dialer creation.
38template <class Argument1>
41{
43}
44
45#endif
46
UnaryCbdataDialer< Argument1 > cbdataDialer(typename UnaryCbdataDialer< Argument1 >::Handler *handler, Argument1 *arg1)
Cbc * valid() const
was set and is valid
Definition: CbcPointer.h:41
Cbc * get() const
a temporary valid raw Cbc pointer or NULL
Definition: CbcPointer.h:159
CbcPointer< Argument1 > arg1
virtual bool canDial(AsyncCall &)
UnaryCbdataDialer(Handler *aHandler, Argument1 *aArg)
void print(std::ostream &os) const override
void Handler(Argument1 *)
void dial(AsyncCall &)
static void handler(int signo)
Definition: purge.cc:858

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors