Ardour  9.0-rc2-125-gf6351399c3
PBD::SignalWithCombiner< Combiner, R(A...)> Class Template Reference

#include <signals.h>

Inheritance diagram for PBD::SignalWithCombiner< Combiner, R(A...)>:
[legend]

Public Types

typedef std::function< R(A...)> slot_function_type
 

Public Member Functions

 ~SignalWithCombiner ()
 
void connect_same_thread (ScopedConnection &c, const slot_function_type &slot)
 
void connect_same_thread (ScopedConnectionList &clist, const slot_function_type &slot)
 
void connect (ScopedConnectionList &clist, PBD::EventLoop::InvalidationRecord *ir, const slot_function_type &slot, PBD::EventLoop *event_loop)
 
void connect (ScopedConnection &c, PBD::EventLoop::InvalidationRecord *ir, const slot_function_type &slot, PBD::EventLoop *event_loop)
 
std::conditional_t< std::is_void_v< R >, R, typename Combiner::result_type > operator() (A... a)
 
bool empty () const
 
size_t size () const
 
- Public Member Functions inherited from PBD::SignalBase
 SignalBase ()
 
virtual ~SignalBase ()
 
void set_debug_connection (bool yn)
 
void set_debug_emission (bool yn)
 

Static Public Member Functions

static void compositor (typename std::function< void(A...)> f, EventLoop *event_loop, EventLoop::InvalidationRecord *ir, A... a)
 

Private Types

typedef std::map< std::shared_ptr< Connection >, slot_function_typeSlots
 

Private Member Functions

std::shared_ptr< Connection_connect (PBD::EventLoop::InvalidationRecord *ir, slot_function_type f)
 
void disconnect (std::shared_ptr< Connection > c)
 

Private Attributes

Slots _slots
 

Friends

class Connection
 

Additional Inherited Members

- Protected Attributes inherited from PBD::SignalBase
Glib::Threads::Mutex _mutex
 
std::atomic< bool > _in_dtor
 
bool _debug_connection
 
bool _debug_emission
 

Detailed Description

template<typename Combiner, typename R, typename... A>
class PBD::SignalWithCombiner< Combiner, R(A...)>

Definition at line 124 of file signals.h.

Member Typedef Documentation

◆ slot_function_type

template<typename Combiner , typename R , typename... A>
typedef std::function<R(A...)> PBD::SignalWithCombiner< Combiner, R(A...)>::slot_function_type

Definition at line 128 of file signals.h.

◆ Slots

template<typename Combiner , typename R , typename... A>
typedef std::map<std::shared_ptr<Connection>, slot_function_type> PBD::SignalWithCombiner< Combiner, R(A...)>::Slots
private

The slots that this signal will call on emission

Definition at line 133 of file signals.h.

Constructor & Destructor Documentation

◆ ~SignalWithCombiner()

template<typename Combiner , typename R , typename... A>
PBD::SignalWithCombiner< Combiner, R(A...)>::~SignalWithCombiner

Definition at line 325 of file signals.h.

Member Function Documentation

◆ _connect()

template<typename Combiner , typename R , typename... A>
std::shared_ptr< Connection > PBD::SignalWithCombiner< Combiner, R(A...)>::_connect ( PBD::EventLoop::InvalidationRecord ir,
slot_function_type  f 
)
private

Definition at line 596 of file signals.h.

◆ compositor()

template<typename Combiner , typename R , typename... A>
void PBD::SignalWithCombiner< Combiner, R(A...)>::compositor ( typename std::function< void(A...)>  f,
EventLoop event_loop,
EventLoop::InvalidationRecord ir,
A...  a 
)
static

Definition at line 317 of file signals.h.

◆ connect() [1/2]

template<typename Combiner , typename R , typename... A>
void PBD::SignalWithCombiner< Combiner, R(A...)>::connect ( ScopedConnection c,
PBD::EventLoop::InvalidationRecord ir,
const slot_function_type slot,
PBD::EventLoop event_loop 
)

See notes for the ScopedConnectionList variant of this function. This differs in that it stores the connection to the signal in a single ScopedConnection rather than a ScopedConnectionList.

Definition at line 413 of file signals.h.

◆ connect() [2/2]

template<typename Combiner , typename R , typename... A>
void PBD::SignalWithCombiner< Combiner, R(A...)>::connect ( ScopedConnectionList clist,
PBD::EventLoop::InvalidationRecord ir,
const slot_function_type slot,
PBD::EventLoop event_loop 
)

Arrange for slot to be executed in the context of event_loop whenever this signal is emitted. Add the connection that represents this arrangement to clist.

If the event loop/thread in which slot will be executed will outlive the lifetime of any object referenced in slot, then an InvalidationRecord should be passed, allowing any request sent to the event_loop and not executed before the object is destroyed to be marked invalid.

"outliving the lifetime" doesn't have a specific, detailed meaning, but is best illustrated by two contrasting examples:

1) the main GUI event loop/thread - this will outlive more or less all objects in the application, and thus when arranging for slot to be called in that context, an invalidation record is highly advisable.

2) a secondary event loop/thread which will be destroyed along with the objects that are typically referenced by slot. Assuming that the event loop is stopped before the objects are destroyed, there is no reason to pass in an invalidation record, and MISSING_INVALIDATOR may be used.

Definition at line 392 of file signals.h.

◆ connect_same_thread() [1/2]

template<typename Combiner , typename R , typename... A>
void PBD::SignalWithCombiner< Combiner, R(A...)>::connect_same_thread ( ScopedConnection c,
const slot_function_type slot 
)

Arrange for slot to be executed whenever this signal is emitted. Store the connection that represents this arrangement in c.

NOTE: slot will be executed in the same thread that the signal is emitted in.

Definition at line 344 of file signals.h.

◆ connect_same_thread() [2/2]

template<typename Combiner , typename R , typename... A>
void PBD::SignalWithCombiner< Combiner, R(A...)>::connect_same_thread ( ScopedConnectionList clist,
const slot_function_type slot 
)

Arrange for slot to be executed whenever this signal is emitted. Add the connection that represents this arrangement to clist.

NOTE: slot will be executed in the same thread that the signal is emitted in.

Definition at line 359 of file signals.h.

◆ disconnect()

template<typename Combiner , typename R , typename... A>
void PBD::SignalWithCombiner< Combiner, R(A...)>::disconnect ( std::shared_ptr< Connection c)
privatevirtual

Implements PBD::SignalBase.

Definition at line 617 of file signals.h.

◆ empty()

template<typename Combiner , typename R , typename... A>
bool PBD::SignalWithCombiner< Combiner, R(A...)>::empty ( ) const
inline

Definition at line 162 of file signals.h.

◆ operator()()

template<typename Combiner , typename R , typename... A>
std::conditional_t< std::is_void_v< R >, R, typename Combiner::result_type > PBD::SignalWithCombiner< Combiner, R(A...)>::operator() ( A...  a)

If R is any kind of void type, then operator() return type must be R, else it must be Combiner::result_type.

Emit this signal. This will cause all slots connected to it be executed in the order that they were connected (cross-thread issues may alter the precise execution time of cross-thread slots).

Definition at line 434 of file signals.h.

◆ size()

template<typename Combiner , typename R , typename... A>
size_t PBD::SignalWithCombiner< Combiner, R(A...)>::size ( ) const
inline

Definition at line 167 of file signals.h.

Friends And Related Function Documentation

◆ Connection

template<typename Combiner , typename R , typename... A>
friend class Connection
friend

Definition at line 174 of file signals.h.

Member Data Documentation

◆ _slots

template<typename Combiner , typename R , typename... A>
Slots PBD::SignalWithCombiner< Combiner, R(A...)>::_slots
private

Definition at line 134 of file signals.h.


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