multitype_join Class

 

A multitype_join messaging block is a multi-source, single-target messaging block that combines together messages of different types from each of its sources and offers a tuple of the combined messages to its targets.

template<
    typename T,  
    join_type _Jtype = non_greedy  
>  
class multitype_join: public ISource<typename _Unwrap<T>::type>;  

Parameters

T
The tuple payload type of the messages joined and propagated by the block.

_Jtype
The kind of join block this is, either greedy or non_greedy

Public Typedefs

NameDescription
typeA type alias for T.

Public Constructors

NameDescription
multitype_join::multitype_join ConstructorOverloaded. Constructs a multitype_join messaging block.
multitype_join::~multitype_join DestructorDestroys the multitype_join messaging block.

Public Methods

NameDescription
multitype_join::accept MethodAccepts a message that was offered by this multitype_join block, transferring ownership to the caller.
multitype_join::acquire_ref MethodAcquires a reference count on this multitype_join messaging block, to prevent deletion.
multitype_join::consume MethodConsumes a message previously offered by the multitype_join messaging block and successfully reserved by the target, transferring ownership to the caller.
multitype_join::link_target MethodLinks a target block to this multitype_join messaging block.
multitype_join::release MethodReleases a previous successful message reservation.
multitype_join::release_ref MethodReleases a reference count on this multiple_join messaging block.
multitype_join::reserve MethodReserves a message previously offered by this multitype_join messaging block.
multitype_join::unlink_target MethodUnlinks a target block from this multitype_join messaging block.
multitype_join::unlink_targets MethodUnlinks all targets from this multitype_join messaging block. (Overrides ISource::unlink_targets.)

For more information, see Asynchronous Message Blocks.

ISource

multitype_join

Header: agents.h

Namespace: concurrency

Accepts a message that was offered by this multitype_join block, transferring ownership to the caller.

virtual message<_Destination_type>* accept(
    runtime_object_identity _MsgId,  
    _Inout_ ITarget<_Destination_type>* _PTarget);

Parameters

_MsgId
The runtime_object_identity of the offered message object.

_PTarget
A pointer to the target block that is calling the accept method.

Return Value

A pointer to the message that the caller now has ownership of.

Acquires a reference count on this multitype_join messaging block, to prevent deletion.

virtual void acquire_ref(_Inout_ ITarget<_Destination_type>* _PTarget);

Parameters

_PTarget
A pointer to the target block that is calling this method.

Remarks

This method is called by an ITarget object that is being linked to this source during the link_target method.

Consumes a message previously offered by the multitype_join messaging block and successfully reserved by the target, transferring ownership to the caller.

virtual message<_Destination_type>* consume(
    runtime_object_identity _MsgId,  
    _Inout_ ITarget<_Destination_type>* _PTarget);

Parameters

_MsgId
The runtime_object_identity of the reserved message object.

_PTarget
A pointer to the target block that is calling the consume method.

Return Value

A pointer to the message object that the caller now has ownership of.

Remarks

The consume method is similar to accept, but must always be preceded by a call to reserve that returned true.

Links a target block to this multitype_join messaging block.

virtual void link_target(_Inout_ ITarget<_Destination_type>* _PTarget);

Parameters

_PTarget
A pointer to an ITarget block to link to this multitype_join messaging block.

Constructs a multitype_join messaging block.

explicit multitype_join(
    T _Tuple);

 
multitype_join(
    Scheduler& _PScheduler,  
    T _Tuple);

 
multitype_join(
    ScheduleGroup& _PScheduleGroup,  
    T _Tuple);

 
multitype_join(
    multitype_join&& _Join);

Parameters

_Tuple
A tuple of sources for this multitype_join messaging block.

_PScheduler
The Scheduler object within which the propagation task for the multitype_join messaging block is scheduled.

_PScheduleGroup
The ScheduleGroup object within which the propagation task for the multitype_join messaging block is scheduled. The Scheduler object used is implied by the schedule group.

_Join
A multitype_join messaging block to copy from. Note that the original object is orphaned, making this a move constructor.

Remarks

The runtime uses the default scheduler if you do not specify the _PScheduler or _PScheduleGroup parameters.

Move construction is not performed under a lock, which means that it is up to the user to make sure that there are no light-weight tasks in flight at the time of moving. Otherwise, numerous races can occur, leading to exceptions or inconsistent state.

Destroys the multitype_join messaging block.

~multitype_join();

Releases a previous successful message reservation.

virtual void release(
    runtime_object_identity _MsgId,  
    _Inout_ ITarget<_Destination_type>* _PTarget);

Parameters

_MsgId
The runtime_object_identity of the message object being released.

_PTarget
A pointer to the target block that is calling the release method.

Releases a reference count on this multiple_join messaging block.

virtual void release_ref(_Inout_ ITarget<_Destination_type>* _PTarget);

Parameters

_PTarget
A pointer to the target block that is calling this method.

Remarks

This method is called by an ITarget object that is being unlinked from this source. The source block is allowed to release any resources reserved for the target block.

Reserves a message previously offered by this multitype_join messaging block.

virtual bool reserve(
    runtime_object_identity _MsgId,  
    _Inout_ ITarget<_Destination_type>* _PTarget);

Parameters

_MsgId
The runtime_object_identity of the message object being reserved.

_PTarget
A pointer to the target block that is calling the reserve method.

Return Value

true if the message was successfully reserved, false otherwise. Reservations can fail for many reasons, including: the message was already reserved or accepted by another target, the source could deny reservations, and so forth.

Remarks

After you call reserve, if it succeeds, you must call either consume or release in order to take or give up possession of the message, respectively.

Unlinks a target block from this multitype_join messaging block.

virtual void unlink_target(_Inout_ ITarget<_Destination_type>* _PTarget);

Parameters

_PTarget
A pointer to an ITarget block to unlink from this multitype_join messaging block.

Unlinks all targets from this multitype_join messaging block.

virtual void unlink_targets();

concurrency Namespace
choice Class
join Class

Show: