Clementine
|
Unmanaged signal handler. More...
#include <entt.hpp>
Public Types | |
using | size_type = std::size_t |
Unsigned integer type. | |
using | sink_type = sink< Ret(Args...)> |
Sink type. | |
template<typename Class > | |
using | instance_type = Class * |
Instance type when it comes to connecting member functions. More... | |
Public Member Functions | |
size_type | size () const ENTT_NOEXCEPT |
Number of listeners connected to the signal. More... | |
bool | empty () const ENTT_NOEXCEPT |
Returns false if at least a listener is connected to the signal. More... | |
void | publish (Args... args) const |
Triggers a signal. More... | |
template<typename Func > | |
void | collect (Func func, Args... args) const |
Collects return values from the listeners. More... | |
Friends | |
class | sink< Ret(Args...)> |
A sink is allowed to modify a signal. | |
Unmanaged signal handler.
It works directly with references to classes and pointers to member functions as well as pointers to free functions. Users of this class are in charge of disconnecting instances before deleting them.
This class serves mainly two purposes:
Ret | Return type of a function type. |
Args | Types of arguments of a function type. |
using entt::sigh< Ret(Args...)>::instance_type = Class * |
Instance type when it comes to connecting member functions.
Class | Type of class to which the member function belongs. |
|
inline |
Collects return values from the listeners.
The collector must expose a call operator with the following properties:
void
or such that it's convertible to bool
. In the second case, a true value will stop the iteration.Ret
is void
, otherwise it contains a single element such that Ret
is convertible to it.Func | Type of collector to use, if any. |
func | A valid function object. |
args | Arguments to use to invoke listeners. |
|
inline |
Returns false if at least a listener is connected to the signal.
|
inline |
Triggers a signal.
All the listeners are notified. Order isn't guaranteed.
args | Arguments to use to invoke listeners. |
|
inline |
Number of listeners connected to the signal.