Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
handler.h
Go to the documentation of this file.
1// Copyright (c) 2018 The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_INTERFACES_HANDLER_H
6#define BITCOIN_INTERFACES_HANDLER_H
7
8#include <functional>
9#include <memory>
10
11namespace boost {
12namespace signals2 {
13 class connection;
14} // namespace signals2
15} // namespace boost
16
17namespace interfaces {
18
22class Handler {
23public:
24 virtual ~Handler() {}
25
27 virtual void disconnect() = 0;
28};
29
31std::unique_ptr<Handler> MakeHandler(boost::signals2::connection connection);
32
34std::unique_ptr<Handler> MakeHandler(std::function<void()> cleanup);
35
36} // namespace interfaces
37
38#endif // BITCOIN_INTERFACES_HANDLER_H
Generic interface for managing an event handler or callback function registered with another interfac...
Definition handler.h:22
virtual ~Handler()
Definition handler.h:24
virtual void disconnect()=0
Disconnect the handler.
std::unique_ptr< Handler > MakeHandler(boost::signals2::connection connection)
Return handler wrapping a boost signal connection.
Definition handler.cpp:48
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85