Bitcoin Core  0.18.99
P2P Digital Currency
handler.cpp
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 #include <interfaces/handler.h>
6 
7 #include <util/memory.h>
8 
9 #include <boost/signals2/connection.hpp>
10 #include <utility>
11 
12 namespace interfaces {
13 namespace {
14 
15 class HandlerImpl : public Handler
16 {
17 public:
18  explicit HandlerImpl(boost::signals2::connection connection) : m_connection(std::move(connection)) {}
19 
20  void disconnect() override { m_connection.disconnect(); }
21 
22  boost::signals2::scoped_connection m_connection;
23 };
24 
25 } // namespace
26 
27 std::unique_ptr<Handler> MakeHandler(boost::signals2::connection connection)
28 {
29  return MakeUnique<HandlerImpl>(std::move(connection));
30 }
31 
32 } // namespace interfaces
boost::signals2::scoped_connection m_connection
Definition: handler.cpp:22
std::unique_ptr< Handler > MakeHandler(boost::signals2::connection connection)
Return handler wrapping a boost signal connection.
Definition: handler.cpp:27