PIVX Core  5.6.99
P2P Digital Currency
handler.cpp
Go to the documentation of this file.
1 // Copyright (c) 2018-2020 The Bitcoin Core developers
2 // Copyright (c) 2020-2021 The PIVX Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or https://www.opensource.org/licenses/mit-license.php.
5 
6 #include <interfaces/handler.h>
7 
8 #include <boost/signals2/connection.hpp>
9 #include <utility>
10 
11 namespace interfaces {
12 namespace {
13 
14 class HandlerImpl : public Handler
15 {
16 public:
17  explicit HandlerImpl(boost::signals2::connection connection) : m_connection(std::move(connection)) {}
18 
19  void disconnect() override { m_connection.disconnect(); }
20 
21  boost::signals2::scoped_connection m_connection;
22 };
23 
24 } // namespace
25 
26 std::unique_ptr<Handler> MakeHandler(boost::signals2::connection connection)
27 {
28  return std::make_unique<HandlerImpl>(std::move(connection));
29 }
30 
31 } // namespace interfaces
Generic interface for managing an event handler or callback function registered with another interfac...
Definition: handler.h:23
boost::signals2::scoped_connection m_connection
Definition: handler.cpp:21
std::unique_ptr< Handler > MakeHandler(boost::signals2::connection connection)
Return handler wrapping a boost signal connection.
Definition: handler.cpp:26