|
| SignalBase () noexcept |
|
| ~SignalBase () |
|
| SignalBase (const SignalBase &)=delete |
|
SignalBase & | operator= (const SignalBase &)=delete |
|
| SignalBase (SignalBase &&o) |
|
SignalBase & | operator= (SignalBase &&o) |
|
template<typename... A> |
void | operator() (A &&... a) const |
| Emit a signal. More...
|
|
template<typename Callable > |
void | connect (Callable &&c) |
| Connect a callable of compatible arguments. More...
|
|
template<typename Callable > |
std::enable_if_t< trait::is_callable_v< arg_list, Callable >, Connection > | connect_connection (Callable &&c) |
| Connect a callable of compatible arguments, returning a Connection. More...
|
|
template<typename Callable > |
std::enable_if_t< trait::is_callable_v< ext_arg_list, Callable >, Connection > | connect_extended (Callable &&c) |
| Connect a callable with an additional Connection argument. More...
|
|
template<typename Pmf , typename Ptr > |
std::enable_if_t< trait::is_callable_v< arg_list, Pmf, Ptr > &&!trait::is_weak_ptr_compatible_v< Ptr >, Connection > | connect (Pmf &&pmf, Ptr &&ptr) |
| Overload of connect for pointers over member functions. More...
|
|
template<typename Pmf , typename Ptr > |
std::enable_if_t< trait::is_callable_v< ext_arg_list, Pmf, Ptr > &&!trait::is_weak_ptr_compatible_v< Ptr >, Connection > | connect_extended (Pmf &&pmf, Ptr &&ptr) |
| Overload of connect for pointer over member functions and. More...
|
|
template<typename Pmf , typename Ptr > |
std::enable_if_t<!trait::is_callable_v< arg_list, Pmf > &&trait::is_weak_ptr_compatible_v< Ptr >, Connection > | connect (Pmf &&pmf, Ptr &&ptr) |
| Overload of connect for lifetime object tracking and automatic disconnection. More...
|
|
template<typename Callable , typename Trackable > |
std::enable_if_t< trait::is_callable_v< arg_list, Callable > &&trait::is_weak_ptr_compatible_v< Trackable >, Connection > | connect (Callable &&c, Trackable &&ptr) |
| Overload of connect for lifetime object tracking and automatic disconnection. More...
|
|
template<typename... CallArgs> |
ScopedConnection | connect_scoped (CallArgs &&...args) |
| Creates a connection whose duration is tied to the return object Use the same semantics as connect. More...
|
|
void | disconnect_all () |
| Disconnects all the slots Safety: Thread safety depends on locking policy. More...
|
|
void | block () noexcept |
| Blocks signal emission Safety: thread safe. More...
|
|
void | unblock () noexcept |
| Unblocks signal emission Safety: thread safe. More...
|
|
bool | blocked () const noexcept |
| Tests blocking state of signal emission. More...
|
|
template<typename Lockable, typename... T>
class wpi::sig::SignalBase< Lockable, T >
SignalBase is an implementation of the observer pattern, through the use of an emitting object and slots that are connected to the signal and called with supplied arguments when a signal is emitted.
wpi::SignalBase is the general implementation, whose locking policy must be set in order to decide thread safety guarantees. wpi::Signal and wpi::Signal_st are partial specializations for multi-threaded and single-threaded use.
It does not allow slots to return a value.
- Template Parameters
-
Lockable | a lock type to decide the lock policy |
T... | the argument types of the emitting and slots functions. |
template<typename Lockable , typename... T>
template<typename Callable >
Connect a callable of compatible arguments.
Effect: Creates and stores a new slot responsible for executing the supplied callable for every subsequent signal emission. Safety: Thread-safety depends on locking policy.
- Parameters
-
template<typename Lockable , typename... T>
template<typename Callable , typename Trackable >
Overload of connect for lifetime object tracking and automatic disconnection.
Trackable must be convertible to an object following a loose form of weak pointer concept, by implementing the ADL-detected conversion function to_weak().
This overload covers the case of a standalone callable and unrelated trackable object.
Note: only weak references are stored, a slot does not extend the lifetime of a suppied object.
- Parameters
-
c | a callable |
ptr | a trackable object pointer |
- Returns
- a Connection object that can be used to interact with the slot
template<typename Lockable , typename... T>
template<typename Pmf , typename Ptr >
Overload of connect for lifetime object tracking and automatic disconnection.
Ptr must be convertible to an object following a loose form of weak pointer concept, by implementing the ADL-detected conversion function to_weak().
This overload covers the case of a pointer over member function and a trackable pointer of that class.
Note: only weak references are stored, a slot does not extend the lifetime of a suppied object.
- Parameters
-
pmf | a pointer over member function |
ptr | a trackable object pointer |
- Returns
- a Connection object that can be used to interact with the slot