Bitcoin Core 28.99.0
P2P Digital Currency
handler.h
Go to the documentation of this file.
1// Copyright (c) 2018-2022 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 {
13class connection;
14} // namespace signals2
15} // namespace boost
16
17namespace interfaces {
18
23{
24public:
25 virtual ~Handler() = default;
26
28 virtual void disconnect() = 0;
29};
30
32std::unique_ptr<Handler> MakeSignalHandler(boost::signals2::connection connection);
33
35std::unique_ptr<Handler> MakeCleanupHandler(std::function<void()> cleanup);
36
37} // namespace interfaces
38
39#endif // BITCOIN_INTERFACES_HANDLER_H
Generic interface for managing an event handler or callback function registered with another interfac...
Definition: handler.h:23
virtual ~Handler()=default
virtual void disconnect()=0
Disconnect the handler.
std::unique_ptr< Handler > MakeSignalHandler(boost::signals2::connection connection)
Return handler wrapping a boost signal connection.
Definition: interfaces.cpp:47
std::unique_ptr< Handler > MakeCleanupHandler(std::function< void()> cleanup)
Return handler wrapping a cleanup function.
Definition: interfaces.cpp:42