Partager via


overwrite_buffer Class

An overwrite_buffer messaging block is a multi-target, multi-source, ordered propagator_block capable of storing a single message at a time. New messages overwrite previously held ones.

template<
   class _Type
>
class overwrite_buffer : public propagator_block<multi_link_registry<ITarget<_Type>>, multi_link_registry<ISource<_Type>>>;

Parameters

  • _Type
    The payload type of the messages stored and propagated by the buffer.

Members

Public Constructors

Name

Description

overwrite_buffer::overwrite_buffer Constructor

Overloaded. Constructs an overwrite_buffer messaging block.

overwrite_buffer::~overwrite_buffer Destructor

Destroys the overwrite_buffer messaging block.

Public Methods

Name

Description

overwrite_buffer::has_value Method

Checks whether this overwrite_buffer messaging block has a value yet.

overwrite_buffer::value Method

Gets a reference to the current payload of the message being stored in the overwrite_buffer messaging block.

Protected Methods

Name

Description

overwrite_buffer::accept_message Method

Accepts a message that was offered by this overwrite_buffer messaging block, returning a copy of the message to the caller.

overwrite_buffer::consume_message Method

Consumes a message previously offered by the overwrite_buffer messaging block and reserved by the target, returning a copy of the message to the caller.

overwrite_buffer::link_target_notification Method

A callback that notifies that a new target has been linked to this overwrite_buffer messaging block.

overwrite_buffer::propagate_message Method

Asynchronously passes a message from an ISource block to this overwrite_buffer messaging block. It is invoked by the propagate method, when called by a source block.

overwrite_buffer::propagate_to_any_targets Method

Places the message_PMessage in this overwrite_buffer messaging block and offers it to all of the linked targets.

overwrite_buffer::release_message Method

Releases a previous message reservation. (Overrides source_block::release_message.)

overwrite_buffer::reserve_message Method

Reserves a message previously offered by this overwrite_buffer messaging block. (Overrides source_block::reserve_message.)

overwrite_buffer::resume_propagation Method

Resumes propagation after a reservation has been released. (Overrides source_block::resume_propagation.)

overwrite_buffer::send_message Method

Synchronously passes a message from an ISource block to this overwrite_buffer messaging block. It is invoked by the send method, when called by a source block.

overwrite_buffer::supports_anonymous_source Method

Overrides the supports_anonymous_source method to indicate that this block can accept messages offered to it by a source that is not linked. (Overrides ITarget::supports_anonymous_source.)

Remarks

An overwrite_buffer messaging block propagates out copies of its stored message to each of its targets.

For more information, see Asynchronous Message Blocks.

Inheritance Hierarchy

ISource

ITarget

source_block

propagator_block

overwrite_buffer

Requirements

Header: agents.h

Namespace: concurrency

See Also

Reference

concurrency Namespace

unbounded_buffer Class

single_assignment Class