Provides the implementation of a signaler. This object has a 1‐1 relationship with the Signaler, which has a shared pointer to it. This allows other objects to refer to it via shared and weak pointers. This allows SignalerConnection objects to outlive the `Signaler ‐ Signaler_Node` pair, since they can test or lock weak pointers to see if the Signaler_Node still exists when they are trying to disconnect themselves.

Synopsis

Declared in <bdlmt_signaler.h>

template<class t_PROT>
class Signaler_Node
    : public bsl::enable_shared_from_this<Signaler_Node<t_PROT>>

Base Classes

Name

Description

bsl::enable_shared_from_this<Signaler_Node<t_PROT>>

This class allows an object that is currently managed by a shared_ptr to safely generate a copy of the managing shared_ptr object. Inheriting from enable_shared_from_this<ELEMENT_TYPE> provides the (template parameter) ELEMENT_TYPE type with a member function shared_from_this. If an object of type ELEMENT_TYPE is managed by a shared_ptr then calling shared_from_this will return a shared_ptr<ELEMENT_TYPE> that shares ownership of that object. It is undefined behavior to call shared_from_this on an object unless that object is managed by a shared_ptr.

Member Functions

Name

Description

Signaler_Node [constructor]

Create a Signaler_Node object having no connected slots. Specify an allocator used to supply memory. Note that the supplied allocator must remain valid until all connection objects associated with this signaler are destroyed.

connect

Implements Signaler::connect. Connect the specified slot, a callable object which must meet the Slot Object Requirements described in the component documentation, to this signaler. Specify a group used to order slots upon invocation. Return an instance of SignalerConnection representing the created connection. This function meets the strong exception guarantee. Note that the connected slot may be called by a signal emitted from another thread before this function completes. Also note that it is unspecified whether connecting a slot while the signaler is emitting will result in the slot being called immediately. Note that t_FUNC may have a return type other than void, but in that case, when the slot is called, the return value will be discarded.

disconnectAllSlots

Implements Signaler::disconnectAllSlots(). Disconnect all slots, if any, connected to this signaler. Any signals emitted on the corresponding signaler that happen after this call to disconnect completes will not call any slots that were connected prior to this call. Throws nothing. Note that this function does not block the calling thread pending completion of ongoing signals emitted on the signaler. Also note that it is unspecified how many slots, if any, will be called by any invocation on the signaler that begins before this function completes. Also note that if a slot is connected to this signaler during a call to this function, it is unspecified whether that slot will be disconnected.

disconnectAllSlotsAndWait

Implements Signaler::disconnectAllSlotsAndWait. Disconnect all slots, if any, connected to this signaler. Any signals emitted on the corresponding signaler that happens after this call to disconnect completes will not call any slots that were connected prior to this call. This function blocks the calling thread pending completion of all ongoing signals being emitted on the signaler. Throws nothing. The behavior is undefined if this method is called from a slot connected to the signaler. Note that it is unspecified how many slots, if any, will be called by any invocation on the signaler that begins before this function completes. Also note that if a slot is connected to this signaler during a call to this function, it is unspecified whether that slot will be disconnected.

disconnectGroup

Implements Signaler::disconnectGroup(). Disconnect all slots, if any, connected to this signaler in the specified group. Any signal emitted on the corresponding signaler that happens after this call to disconnect completes will not call any slots in group that were connected prior to this call. Throws nothing. Note that this function does not block the calling thread pending completion of ongoing signals emitted on the signaler. Also note that it is unspecified how many affected slots, if any, will be signalled to by any invocation on the signaler that begins before this function completes. Also note that if a slot in group is connected to this signaler during a call to this function, it is unspecified whether that slot will be disconnected.

disconnectGroupAndWait

Implements Signaler::disconnectGroupAndWait(). Disconnect all slots, if any, connected to this signaler in the specified group. Any signal emitted on the corresponding signaler that happens after this call to disconnect completes will not call any slots in group that were connected prior to this call. This function blocks the calling thread pending completion of ongoing signals being emitted on the signaler. Throws nothing. The behavior is undefined if this method is called from a slot connected to the signaler. Note that it is unspecified how many affected slots, if any, will be signaled to by any emission on the signaler that begins before this function completes. Also note that if a slot in group is connected to this signaler during a call to this function, it is unspecified whether that slot will be disconnected.

invoke

Called by Signaler_Invocable`s call operators, passing the specified `arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 and arg9 on to the slots.

notifyDisconnected

Notify this signaler that a slot with the specified slotMapKey was disconnected. Throws nothing.

shared_from_this

shared_from_this overloads

slotCount

Implements Signaler::slotCount(). Return the number of slots connected to this signaler. Note that in multithreaded environment, the value returned by slotCount() is approximate.

synchronizeWait

Block until all signals currently being emitted on the signaler have completed.

weak_from_this

weak_from_this overloads

Protected Member Functions

Name

Description

operator=

Return *this. This object is unchanged. Note that the specified rhs is not used.

Created with MrDocs