Quick Links:

bal | bbl | bdl | bsl

Public Member Functions | Friends

bdlmt::Signaler_Node< t_PROT > Class Template Reference

#include <bdlmt_signaler.h>

Inheritance diagram for bdlmt::Signaler_Node< t_PROT >:
bsl::enable_shared_from_this< Signaler_Node< t_PROT > >

List of all members.

Public Member Functions

 Signaler_Node (bslma::Allocator *allocator)
template<class t_FUNC >
SignalerConnection connect (BSLS_COMPILERFEATURES_FORWARD_REF(t_FUNC) slot, int group)
void disconnectAllSlots () BSLS_KEYWORD_NOEXCEPT
void disconnectAllSlotsAndWait () BSLS_KEYWORD_NOEXCEPT
void disconnectGroup (int group) BSLS_KEYWORD_NOEXCEPT
void disconnectGroupAndWait (int group) BSLS_KEYWORD_NOEXCEPT
void notifyDisconnected (SlotMapKey slotMapKey) BSLS_KEYWORD_NOEXCEPT
void synchronizeWait () BSLS_KEYWORD_NOEXCEPT
void invoke (typename ArgumentType::ForwardingType1 arg1, typename ArgumentType::ForwardingType2 arg2, typename ArgumentType::ForwardingType3 arg3, typename ArgumentType::ForwardingType4 arg4, typename ArgumentType::ForwardingType5 arg5, typename ArgumentType::ForwardingType6 arg6, typename ArgumentType::ForwardingType7 arg7, typename ArgumentType::ForwardingType8 arg8, typename ArgumentType::ForwardingType9 arg9) const
bsl::size_t slotCount () const
bsl::shared_ptr< Signaler_Node
< t_PROT > > 
shared_from_this ()
bsl::shared_ptr< const
Signaler_Node< t_PROT > > 
shared_from_this () const
bsl::weak_ptr< Signaler_Node
< t_PROT > > 
weak_from_this () BSLS_KEYWORD_NOEXCEPT
bsl::weak_ptr< const
Signaler_Node< t_PROT > > 
weak_from_this () const BSLS_KEYWORD_NOEXCEPT

Friends

struct BloombergLP::bslstl::SharedPtr_ImpUtil

Detailed Description

template<class t_PROT>
class bdlmt::Signaler_Node< t_PROT >

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.

See Component bdlmt_signaler


Constructor & Destructor Documentation

template<class t_PROT >
bdlmt::Signaler_Node< t_PROT >::Signaler_Node ( bslma::Allocator allocator  )  [explicit]

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.


Member Function Documentation

template<class t_PROT >
template<class t_FUNC >
SignalerConnection bdlmt::Signaler_Node< t_PROT >::connect ( BSLS_COMPILERFEATURES_FORWARD_REF(t_FUNC)  slot,
int  group 
)

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.

template<class t_PROT >
void bdlmt::Signaler_Node< t_PROT >::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.

template<class t_PROT >
void bdlmt::Signaler_Node< t_PROT >::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.

template<class t_PROT >
void bdlmt::Signaler_Node< t_PROT >::disconnectGroup ( int  group  ) 

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.

template<class t_PROT >
void bdlmt::Signaler_Node< t_PROT >::disconnectGroupAndWait ( int  group  ) 

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.

template<class t_PROT >
void bdlmt::Signaler_Node< t_PROT >::notifyDisconnected ( SlotMapKey  slotMapKey  ) 

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

template<class t_PROT >
void bdlmt::Signaler_Node< t_PROT >::synchronizeWait (  ) 

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

template<class t_PROT >
void bdlmt::Signaler_Node< t_PROT >::invoke ( typename ArgumentType::ForwardingType1  arg1,
typename ArgumentType::ForwardingType2  arg2,
typename ArgumentType::ForwardingType3  arg3,
typename ArgumentType::ForwardingType4  arg4,
typename ArgumentType::ForwardingType5  arg5,
typename ArgumentType::ForwardingType6  arg6,
typename ArgumentType::ForwardingType7  arg7,
typename ArgumentType::ForwardingType8  arg8,
typename ArgumentType::ForwardingType9  arg9 
) const

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

template<class t_PROT >
bsl::size_t bdlmt::Signaler_Node< t_PROT >::slotCount (  )  const

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

bsl::shared_ptr<Signaler_Node< t_PROT > > bsl::enable_shared_from_this< Signaler_Node< t_PROT > >::shared_from_this (  )  [inherited]

Return a shared_ptr<ELEMENT_TYPE> that shares ownership with an existing shared_ptr object that managed this object, and throw a std::bad_weak_ptr exception if there is no shared_ptr currently managing this object. If multiple groups of shared_ptrs are managing this object, the returned shared_ptr will share ownership with the group that first managed this object.

bsl::shared_ptr<const Signaler_Node< t_PROT > > bsl::enable_shared_from_this< Signaler_Node< t_PROT > >::shared_from_this (  )  const [inherited]

Return a shared_ptr<const ELEMENT_TYPE> that shares ownership with an existing shared_ptr object that managed this object, and throw a std::bad_weak_ptr exception if there is no shared_ptr currently managing this object. If multiple groups of shared_ptrs are managing this object, the returned shared_ptr will share ownership with the group that first managed this object.

bsl::weak_ptr<Signaler_Node< t_PROT > > bsl::enable_shared_from_this< Signaler_Node< t_PROT > >::weak_from_this (  )  [inherited]

Return a weak_ptr holding a weak reference to this managed object if this object is currently managed by shared_ptr, and return an expired weak_ptr otherwise. If multiple groups of shared_ptrs are managing this object, the returned weak_ptr will hold a weak reference to the group that first managed this object.

bsl::weak_ptr<const Signaler_Node< t_PROT > > bsl::enable_shared_from_this< Signaler_Node< t_PROT > >::weak_from_this (  )  const [inherited]

Return a weak_ptr holding a weak reference (with only const access) to this managed object if this object is currently managed by shared_ptr, and return an expired weak_ptr otherwise. If multiple groups of shared_ptrs are managing this object, the returned weak_ptr will hold a weak reference to the group that first managed this object.


Friends And Related Function Documentation

friend struct BloombergLP::bslstl::SharedPtr_ImpUtil [friend, inherited]

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