Share via


source_block Class

The source_block class is an abstract base class for source-only blocks. The class provides basic link management functionality as well as common error checks.

template<
   class _TargetLinkRegistry,
   class _MessageProcessorType = ordered_message_processor<typename _TargetLinkRegistry::type::type>
>
class source_block : public ISource<typename _TargetLinkRegistry::type::type>;

Parameters

  • _TargetLinkRegistry
    Link registry to be used for holding the target links.

  • _MessageProcessorType
    Processor type for message processing.

Members

Public Typedefs

Name

Description

target_iterator

The iterator to walk the connected targets.

Public Constructors

Name

Description

source_block::source_block Constructor

Constructs a source_block object.

source_block::~source_block Destructor

Destroys the source_block object.

Public Methods

Name

Description

source_block::accept Method

Accepts a message that was offered by this source_block object, transferring ownership to the caller.

source_block::acquire_ref Method

Acquires a reference count on this source_block object, to prevent deletion.

source_block::consume Method

Consumes a message previously offered by this source_block object and successfully reserved by the target, transferring ownership to the caller.

source_block::link_target Method

Links a target block to this source_block object.

source_block::release Method

Releases a previous successful message reservation.

source_block::release_ref Method

Releases a reference count on this source_block object.

source_block::reserve Method

Reserves a message previously offered by this source_block object.

source_block::unlink_target Method

Unlinks a target block from this source_block object.

source_block::unlink_targets Method

Unlinks all target blocks from this source_block object. (Overrides ISource::unlink_targets.)

Protected Methods

Name

Description

source_block::accept_message Method

When overridden in a derived class, accepts an offered message by the source. Message blocks should override this method to validate the _MsgId and return a message.

source_block::async_send Method

Asynchronously queues up messages and starts a propagation task, if this has not been done already

source_block::consume_message Method

When overridden in a derived class, consumes a message that was previously reserved.

source_block::initialize_source Method

Initializes the message_propagator within this source_block.

source_block::link_target_notification Method

A callback that notifies that a new target has been linked to this source_block object.

source_block::propagate_to_any_targets Method

When overridden in a derived class, propagates the given message to any or all of the linked targets. This is the main propagation routine for message blocks.

source_block::release_message Method

When overridden in a derived class, releases a previous message reservation.

source_block::remove_targets Method

Removes all target links for this source block. This should be called from the destructor.

source_block::reserve_message Method

When overridden in a derived class, reserves a message previously offered by this source_block object.

source_block::resume_propagation Method

When overridden in a derived class, resumes propagation after a reservation has been released.

source_block::sync_send Method

Synchronously queues up messages and starts a propagation task, if this has not been done already.

source_block::unlink_target_notification Method

A callback that notifies that a target has been unlinked from this source_block object.

source_block::wait_for_outstanding_async_sends Method

Waits for all asynchronous propagations to complete. This propagator-specific spin wait is used in destructors of message blocks to make sure that all asynchronous propagations have time to finish before destroying the block.

Remarks

Message blocks should derive from this block to take advantage of link management and synchronization provided by this class.

Inheritance Hierarchy

ISource

source_block

Requirements

Header: agents.h

Namespace: Concurrency

See Also

Reference

Concurrency Namespace

ISource Class