|
mc_rtc
2.14.0
|
#include <mc_rtc/SignalSlot.h>
Classes | |
| struct | Proxy |
Public Types | |
| using | SignalT = Signal< ArgsT... > |
| using | SlotT = Slot< ArgsT... > |
| using | CallbackT = std::function< void(ArgsT...)> |
Public Member Functions | |
| Signal ()=default | |
| template<typename Callable > | |
| SlotT | connect (Callable &&callback) |
| void | signal (ArgsT... args) |
Public Attributes | |
| friend | SlotT |
Protected Member Functions | |
| void | disconnect (size_t idx) |
Protected Attributes | |
| std::vector< CallbackT > | callbacks_ |
| size_t | next_slot_ = 0 |
A signal class
Provides a way to connect to the signal, i.e. register a callback that will be called whenever the signal is raised via the signal method.
You can use this mechanism in your own code (controller, state, interface, observer...) however you must be aware of the following assumptions that are true to all usage within mc_rtc:
| ArgsT | Arguments of the signal callback |
| using mc_rtc::Signal< ArgsT >::CallbackT = std::function<void(ArgsT...)> |
| using mc_rtc::Signal< ArgsT >::SignalT = Signal<ArgsT...> |
| using mc_rtc::Signal< ArgsT >::SlotT = Slot<ArgsT...> |
|
default |
|
inline |
Connect a callback to the signal and returns a connected slot
| callback | Any callback that will match |
| ArgsT |
|
inlineprotected |
|
inline |
Trigger a signal with the provided arguments
\params args Arguments passed to subscribers
|
protected |
|
protected |
| friend mc_rtc::Signal< ArgsT >::SlotT |