AsyncFunCalls.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2022 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_ASYNCFUNCALLS_H
10 #define SQUID_BASE_ASYNCFUNCALLS_H
11 
12 #include "base/AsyncCall.h"
13 
14 #include <iostream>
15 
18 {
19 public:
20  using Handler = void ();
21 
22  explicit NullaryFunDialer(Handler * const aHandler): handler(aHandler) {}
23 
24  /* CallDialer API */
25  bool canDial(AsyncCall &) { return bool(handler); }
26  void dial(AsyncCall &) { handler(); }
27  virtual void print(std::ostream &os) const override { os << "()"; }
28 
29 private:
31 };
32 
33 #endif /* SQUID_BASE_ASYNCFUNCALLS_H */
34 
Calls a function without arguments. See also: NullaryMemFunT.
Definition: AsyncFunCalls.h:18
bool canDial(AsyncCall &)
Definition: AsyncFunCalls.h:25
Handler * handler
the function to call (or nil)
Definition: AsyncFunCalls.h:30
void dial(AsyncCall &)
Definition: AsyncFunCalls.h:26
virtual void print(std::ostream &os) const override
Definition: AsyncFunCalls.h:27
NullaryFunDialer(Handler *const aHandler)
Definition: AsyncFunCalls.h:22

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors