EnTT 3.13.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
entt::sink< sigh< Ret(Args...), Allocator > > Class Template Reference

Sink class. More...

#include <sigh.hpp>

Public Member Functions

 sink (sigh< Ret(Args...), Allocator > &ref) noexcept
 Constructs a sink that is allowed to modify a given signal.
 
bool empty () const noexcept
 Returns false if at least a listener is connected to the sink.
 
template<auto Candidate, typename... Type>
connection connect (Type &&...value_or_instance)
 Connects a free function (with or without payload), a bound or an unbound member to a signal.
 
template<auto Candidate, typename... Type>
void disconnect (Type &&...value_or_instance)
 Disconnects a free function (with or without payload), a bound or an unbound member from a signal.
 
void disconnect (const void *value_or_instance)
 Disconnects free functions with payload or bound members from a signal.
 
void disconnect ()
 Disconnects all the listeners from a signal.
 

Detailed Description

template<typename Ret, typename... Args, typename Allocator>
class entt::sink< sigh< Ret(Args...), Allocator > >

Sink class.

A sink is used to connect listeners to signals and to disconnect them.
The function type for a listener is the one of the signal to which it belongs.

The clear separation between a signal and a sink permits to store the former as private data member without exposing the publish functionality to the users of the class.

Warning
Lifetime of a sink must not overcome that of the signal to which it refers. In any other case, attempting to use a sink results in undefined behavior.
Template Parameters
RetReturn type of a function type.
ArgsTypes of arguments of a function type.
AllocatorType of allocator used to manage memory and elements.

Definition at line 358 of file sigh.hpp.

Constructor & Destructor Documentation

◆ sink()

template<typename Ret , typename... Args, typename Allocator >
entt::sink< sigh< Ret(Args...), Allocator > >::sink ( sigh< Ret(Args...), Allocator > &  ref)
inlinenoexcept

Constructs a sink that is allowed to modify a given signal.

Parameters
refA valid reference to a signal object.

Definition at line 388 of file sigh.hpp.

Member Function Documentation

◆ connect()

template<typename Ret , typename... Args, typename Allocator >
template<auto Candidate, typename... Type>
connection entt::sink< sigh< Ret(Args...), Allocator > >::connect ( Type &&...  value_or_instance)
inline

Connects a free function (with or without payload), a bound or an unbound member to a signal.

Template Parameters
CandidateFunction or member to connect to the signal.
TypeType of class or type of payload, if any.
Parameters
value_or_instanceA valid object that fits the purpose, if any.
Returns
A properly initialized connection object.

Definition at line 408 of file sigh.hpp.

◆ disconnect() [1/3]

template<typename Ret , typename... Args, typename Allocator >
void entt::sink< sigh< Ret(Args...), Allocator > >::disconnect ( )
inline

Disconnects all the listeners from a signal.

Definition at line 446 of file sigh.hpp.

◆ disconnect() [2/3]

template<typename Ret , typename... Args, typename Allocator >
void entt::sink< sigh< Ret(Args...), Allocator > >::disconnect ( const void *  value_or_instance)
inline

Disconnects free functions with payload or bound members from a signal.

Parameters
value_or_instanceA valid object that fits the purpose.

Definition at line 439 of file sigh.hpp.

◆ disconnect() [3/3]

template<typename Ret , typename... Args, typename Allocator >
template<auto Candidate, typename... Type>
void entt::sink< sigh< Ret(Args...), Allocator > >::disconnect ( Type &&...  value_or_instance)
inline

Disconnects a free function (with or without payload), a bound or an unbound member from a signal.

Template Parameters
CandidateFunction or member to disconnect from the signal.
TypeType of class or type of payload, if any.
Parameters
value_or_instanceA valid object that fits the purpose, if any.

Definition at line 428 of file sigh.hpp.

◆ empty()

template<typename Ret , typename... Args, typename Allocator >
bool entt::sink< sigh< Ret(Args...), Allocator > >::empty ( ) const
inlinenoexcept

Returns false if at least a listener is connected to the sink.

Returns
True if the sink has no listeners connected, false otherwise.

Definition at line 395 of file sigh.hpp.


The documentation for this class was generated from the following file: