2017-04-17 13:55:43 -04:00
|
|
|
// Copyright (c) 2018 The Bitcoin Core developers
|
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2018-04-07 03:42:02 -04:00
|
|
|
#include <interfaces/handler.h>
|
2017-04-17 13:55:43 -04:00
|
|
|
|
2018-07-12 00:39:40 -04:00
|
|
|
#include <utilmemory.h>
|
2017-04-17 13:55:43 -04:00
|
|
|
|
|
|
|
#include <boost/signals2/connection.hpp>
|
|
|
|
#include <utility>
|
|
|
|
|
2018-04-07 03:42:02 -04:00
|
|
|
namespace interfaces {
|
2017-04-17 13:55:43 -04:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
class HandlerImpl : public Handler
|
|
|
|
{
|
|
|
|
public:
|
2018-07-26 17:15:32 +02:00
|
|
|
explicit HandlerImpl(boost::signals2::connection connection) : m_connection(std::move(connection)) {}
|
2017-04-17 13:55:43 -04:00
|
|
|
|
|
|
|
void disconnect() override { m_connection.disconnect(); }
|
|
|
|
|
|
|
|
boost::signals2::scoped_connection m_connection;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
std::unique_ptr<Handler> MakeHandler(boost::signals2::connection connection)
|
|
|
|
{
|
|
|
|
return MakeUnique<HandlerImpl>(std::move(connection));
|
|
|
|
}
|
|
|
|
|
2018-04-07 03:42:02 -04:00
|
|
|
} // namespace interfaces
|