Share via


choice Class

A choice messaging block is a multi-source, single-target block that represents a control-flow interaction with a set of sources. The choice block will wait for any one of multiple sources to produce a message and will propagate the index of the source that produced the message.

template<
   class _Type
>
class choice: public ISource<size_t>;

Parameters

  • _Type
    A tuple-based type representing the payloads of the input sources.

Members

Public Typedefs

Name

Description

type

A type alias for _Type.

Public Constructors

Name

Description

choice::choice Constructor

Overloaded. Constructs a choice messaging block.

choice::~choice Destructor

Destroys the choice messaging block.

Public Methods

Name

Description

choice::accept Method

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

choice::acquire_ref Method

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

choice::consume Method

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

choice::has_value Method

Checks whether this choice messaging block has been initialized with a value yet.

choice::index Method

Returns an index into the tuple representing the element selected by the choice messaging block.

choice::link_target Method

Links a target block to this choice messaging block.

choice::release Method

Releases a previous successful message reservation.

choice::release_ref Method

Releases a reference count on this choice messaging block.

choice::reserve Method

Reserves a message previously offered by this choice messaging block.

choice::unlink_target Method

Unlinks a target block from this choice messaging block.

choice::unlink_targets Method

Unlinks all targets from this choice messaging block. (Overrides ISource::unlink_targets.)

choice::value Method

Gets the message whose index was selected by the choice messaging block.

Remarks

The choice block ensures that only one of the incoming messages is consumed.

For more information, see Asynchronous Message Blocks.

Inheritance Hierarchy

ISource

choice

Requirements

Header: agents.h

Namespace: Concurrency

See Also

Reference

Concurrency Namespace

join Class

single_assignment Class

make_choice Function

tuple Class