EnTT 3.13.1
|
Unmanaged signal handler. More...
#include <sigh.hpp>
Public Types | |
using | allocator_type = Allocator |
Allocator type. | |
using | size_type = std::size_t |
Unsigned integer type. | |
using | sink_type = sink<sigh<Ret(Args...), Allocator>> |
Sink type. | |
Public Member Functions | |
sigh () noexcept(std::is_nothrow_default_constructible_v< allocator_type > &&std::is_nothrow_constructible_v< container_type, const allocator_type & >) | |
Default constructor. | |
sigh (const allocator_type &allocator) noexcept(std::is_nothrow_constructible_v< container_type, const allocator_type & >) | |
Constructs a signal handler with a given allocator. | |
sigh (const sigh &other) noexcept(std::is_nothrow_copy_constructible_v< container_type >) | |
Copy constructor. | |
sigh (const sigh &other, const allocator_type &allocator) noexcept(std::is_nothrow_constructible_v< container_type, const container_type &, const allocator_type & >) | |
Allocator-extended copy constructor. | |
sigh (sigh &&other) noexcept(std::is_nothrow_move_constructible_v< container_type >) | |
Move constructor. | |
sigh (sigh &&other, const allocator_type &allocator) noexcept(std::is_nothrow_constructible_v< container_type, container_type &&, const allocator_type & >) | |
Allocator-extended move constructor. | |
sigh & | operator= (const sigh &other) noexcept(std::is_nothrow_copy_assignable_v< container_type >) |
Copy assignment operator. | |
sigh & | operator= (sigh &&other) noexcept(std::is_nothrow_move_assignable_v< container_type >) |
Move assignment operator. | |
void | swap (sigh &other) noexcept(std::is_nothrow_swappable_v< container_type >) |
Exchanges the contents with those of a given signal handler. | |
constexpr allocator_type | get_allocator () const noexcept |
Returns the associated allocator. | |
size_type | size () const noexcept |
Number of listeners connected to the signal. | |
bool | empty () const noexcept |
Returns false if at least a listener is connected to the signal. | |
void | publish (Args... args) const |
Triggers a signal. | |
template<typename Func > | |
void | collect (Func func, Args... args) const |
Collects return values from the listeners. | |
Friends | |
class | sink< sigh< Ret(Args...), Allocator > > |
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. |
Allocator | Type of allocator used to manage memory and elements. |
using entt::sigh< Ret(Args...), Allocator >::allocator_type = Allocator |
using entt::sigh< Ret(Args...), Allocator >::size_type = std::size_t |
|
inlinenoexcept |
|
inlineexplicitnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
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. |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |