Share via


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.

Syntax

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

Members

Public Typedefs

Name Description
type A type alias for T.

Public Constructors

Name Description
multitype_join::multitype_join Constructor Overloaded. Constructs a multitype_join messaging block.
multitype_join::~multitype_join Destructor Destroys the multitype_join messaging block.

Public Methods

Name Description
multitype_join::accept Method Accepts a message that was offered by this multitype_join block, transferring ownership to the caller.
multitype_join::acquire_ref Method Acquires a reference count on this multitype_join messaging block, to prevent deletion.
multitype_join::consume Method Consumes 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 Method Links a target block to this multitype_join messaging block.
multitype_join::release Method Releases a previous successful message reservation.
multitype_join::release_ref Method Releases a reference count on this multiple_join messaging block.
multitype_join::reserve Method Reserves a message previously offered by this multitype_join messaging block.
multitype_join::unlink_target Method Unlinks a target block from this multitype_join messaging block.
multitype_join::unlink_targets Method Unlinks all targets from this multitype_join messaging block. (Overrides ISource::unlink_targets.)

Remarks

For more information, see Asynchronous Message Blocks.

Inheritance Hierarchy

ISource

multitype_join

Requirements

Header: agents.h

Namespace: concurrency

multitype_join::accept Method

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.

multitype_join::acquire_ref Method

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.

multitype_join::consume 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.

multitype_join::multitype_join Constructor

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.

multitype_join::~multitype_join Destructor

Destroys the multitype_join messaging block.

~multitype_join();

multitype_join::release Method

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.

multitype_join::release_ref 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.

multitype_join::reserve Method

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();

See Also

concurrency Namespace
choice Class
join Class