8#include <boost/signals2/connection.hpp>
17 explicit CleanupHandler(std::function<
void()> cleanup) :
m_cleanup(
std::move(cleanup)) {}
26 explicit SignalHandler(boost::signals2::connection connection) :
m_connection(std::move(connection)) {}
28 void disconnect()
override {
m_connection.disconnect(); }
36 std::string
echo(
const std::string&
echo)
override {
return echo; }
44 return std::make_unique<common::CleanupHandler>(std::move(cleanup));
49 return std::make_unique<common::SignalHandler>(std::move(connection));
52std::unique_ptr<Echo>
MakeEcho() {
return std::make_unique<common::EchoImpl>(); }
Simple string echoing interface for testing.
Generic interface for managing an event handler or callback function registered with another interfac...
std::function< void()> m_cleanup
boost::signals2::scoped_connection m_connection
std::unique_ptr< Handler > MakeSignalHandler(boost::signals2::connection connection)
Return handler wrapping a boost signal connection.
std::unique_ptr< Echo > MakeEcho()
Return implementation of Echo interface.
std::unique_ptr< Handler > MakeCleanupHandler(std::function< void()> cleanup)
Return handler wrapping a cleanup function.
static RPCHelpMan echo(const std::string &name)