blob: 1a76e174ec06cc03e28eff62c992f382772b20a9 [file] [log] [blame]
Tomáš Pecka7ff533b2020-07-17 15:01:16 +02001/*
2 * Copyright (C) 2020 CESNET, https://photonics.cesnet.cz/
3 *
4 * Written by Tomáš Pecka <tomas.pecka@fit.cvut.cz>
5 *
6*/
7#pragma once
8
Tomáš Pecka261c8862020-11-05 11:23:08 +01009namespace velia::health {
Tomáš Pecka7ff533b2020-07-17 15:01:16 +020010
11class LedOutputCallback;
12
13namespace boost::signals2 {
14
15/**
16 * Wraps a slot in a copyable class. Ensures that destructor of the Slot is called only once.
17 */
18template <typename Ret, typename... Args>
19class SlotWrapper {
20public:
21 explicit SlotWrapper(std::shared_ptr<LedOutputCallback> callback)
22 : m_callback(callback)
23 {
24 }
25
26 Ret operator()(Args... args)
27 {
28 (*m_callback)(args...);
29 }
30
31private:
32 std::shared_ptr<LedOutputCallback> m_callback;
33};
34
35}
36
Tomáš Pecka261c8862020-11-05 11:23:08 +010037}