|
| | signal_base () noexcept |
| |
| | ~signal_base () override |
| |
| | signal_base (const signal_base &)=delete |
| |
| signal_base & | operator= (const signal_base &)=delete |
| |
| | signal_base (signal_base &&o) |
| |
| signal_base & | operator= (signal_base &&o) |
| |
| template<typename... U> |
| void | operator() (U &&...a) |
| |
| template<typename Callable > |
| std::enable_if_t< trait::is_callable_v< arg_list, Callable >, connection > | connect (Callable &&c, group_id gid=0) |
| |
| template<typename Callable > |
| std::enable_if_t< trait::is_callable_v< ext_arg_list, Callable >, connection > | connect_extended (Callable &&c, group_id gid=0) |
| |
| template<typename Pmf , typename Ptr > |
| std::enable_if_t< trait::is_callable_v< arg_list, Pmf, Ptr > &&trait::is_observer_v< Ptr >, connection > | connect (Pmf &&pmf, Ptr &&ptr, group_id gid=0) |
| |
| template<typename Pmf , typename Ptr > |
| std::enable_if_t< trait::is_callable_v< arg_list, Pmf, Ptr > &&!trait::is_observer_v< Ptr > &&!trait::is_weak_ptr_compatible_v< Ptr >, connection > | connect (Pmf &&pmf, Ptr &&ptr, group_id gid=0) |
| |
| 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, group_id gid=0) |
| |
| 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, group_id gid=0) |
| |
| 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, group_id gid=0) |
| |
| template<typename... CallArgs> |
| scoped_connection | connect_scoped (CallArgs &&...args) |
| |
| template<typename Callable > |
| std::enable_if_t<(trait::is_callable_v< arg_list, Callable >||trait::is_callable_v< ext_arg_list, Callable >||trait::is_pmf_v< Callable >) &&detail::function_traits< Callable >::is_disconnectable, size_t > | disconnect (const Callable &c) |
| |
| template<typename Obj > |
| std::enable_if_t<!trait::is_callable_v< arg_list, Obj > &&!trait::is_callable_v< ext_arg_list, Obj > &&!trait::is_pmf_v< Obj >, size_t > | disconnect (const Obj &obj) |
| |
| template<typename Callable , typename Obj > |
| size_t | disconnect (const Callable &c, const Obj &obj) |
| |
| size_t | disconnect (group_id gid) |
| |
| void | disconnect_all () |
| |
| void | block () noexcept |
| |
| void | unblock () noexcept |
| |
| bool | blocked () const noexcept |
| |
| size_t | slot_count () noexcept |
| |
| virtual | ~cleanable ()=default |
| |
| virtual void | clean (slot_state *)=0 |
| |
template<typename Lockable, typename... T>
class sigslot::signal_base< Lockable, T >
signal_base 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.
signal_base is the general implementation, whose locking policy must be set in order to decide thread safety guarantees. signal and signal_st are partial specializations for multi-threaded and single-threaded use.
It does not allow slots to return a value.
Slot execution order can be constrained by assigning group ids to the slots. The execution order of slots in a same group is unspecified and should not be relied upon, however groups are executed in ascending group ids order. When the group id of a slot is not set, it is assigned to the group 0. Group ids can have any value in the range of signed 32 bit integers.
- 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 , 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 |
| gid | an identifier that can be used to order slot execution |
- 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 |
| gid | an identifier that can be used to order slot execution |
- Returns
- a connection object that can be used to interact with the slot
template<typename Lockable , typename... T>
template<typename Callable >
Disconnect slots bound to a callable
Effect: Disconnects all the slots bound to the callable in argument. Safety: Thread-safety depends on locking policy.
If the callable is a free or static member function, this overload is always available. However, RTTI is needed for it to work for pointer to member functions, function objects or and (references to) lambdas, because the C++ spec does not mandate the pointers to member functions to be unique.
- Parameters
-
- Returns
- the number of disconnected slots
template<typename Lockable , typename... T>
template<typename Callable , typename Obj >
Disconnect slots bound both to a callable and object
Effect: Disconnects all the slots bound to the callable and object in argument. Safety: Thread-safety depends on locking policy.
For naked pointers, the Callable is expected to be a pointer over member function. If obj is trackable, any kind of Callable can be used.
- Parameters
-
- Returns
- the number of disconnected slots