blob: c01ee6ce7a00103eb9a67be90e1ddf1536c2a6d4 [file] [log] [blame]
/*
* Copyright (C) 2020 CESNET, https://photonics.cesnet.cz/
*
* Written by Tomáš Pecka <tomas.pecka@fit.cvut.cz>
*
*/
#pragma once
namespace velia {
class LedOutputCallback;
namespace boost::signals2 {
/**
* Wraps a slot in a copyable class. Ensures that destructor of the Slot is called only once.
*/
template <typename Ret, typename... Args>
class SlotWrapper {
public:
explicit SlotWrapper(std::shared_ptr<LedOutputCallback> callback)
: m_callback(callback)
{
}
Ret operator()(Args... args)
{
(*m_callback)(args...);
}
private:
std::shared_ptr<LedOutputCallback> m_callback;
};
}
}