source_block::accept Method

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

virtual message<_Target_type> * accept(
   runtime_object_identity _MsgId,
   ITarget<_Target_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 object that the caller now has ownership of.

Remarks

The method throws an invalid_argument exception if the parameter _PTarget is NULL.

The accept method is called by a target while a message is being offered by this ISource block. The message pointer returned may be different from the one passed into the propagate method of the ITarget block, if this source decides to make a copy of the message.

Requirements

Header: agents.h

Namespace: Concurrency

See Also

Reference

source_block Class