Edit

Share via


call Class

A call messaging block is a multi-source, ordered target_block that invokes a specified function when receiving a message.

Syntax

template<class T, class _FunctorType = std::function<void(T const&)>>
class call : public target_block<multi_link_registry<ISource<T>>>;

Parameters

T
The payload type of the messages propagated to this block.

_FunctorType
The signature of functions that this block can accept.

Members

Public Constructors

Name Description
call Overloaded. Constructs a call messaging block.
~call Destructor Destroys the call messaging block.

Protected Methods

Name Description
process_input_messages Executes the call function on the input messages.
process_message Processes a message that was accepted by this call messaging block.
propagate_message Asynchronously passes a message from an ISource block to this call messaging block. It is invoked by the propagate method, when called by a source block.
send_message Synchronously passes a message from an ISource block to this call messaging block. It is invoked by the send method, when called by a source block.
supports_anonymous_source 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

For more information, see Asynchronous Message Blocks.

Inheritance Hierarchy

ITarget

target_block

call

Requirements

Header: agents.h

Namespace: concurrency

call

Constructs a call messaging block.

call(
    _Call_method const& _Func);

call(
    _Call_method const& _Func,
    filter_method const& _Filter);

call(
    Scheduler& _PScheduler,
    _Call_method const& _Func);

call(
    Scheduler& _PScheduler,
    _Call_method const& _Func,
    filter_method const& _Filter);

call(
    ScheduleGroup& _PScheduleGroup,
    _Call_method const& _Func);

call(
    ScheduleGroup& _PScheduleGroup,
    _Call_method const& _Func,
    filter_method const& _Filter);

Parameters

_Func
A function that will be invoked for each accepted message.

_Filter
A filter function which determines whether offered messages should be accepted.

_PScheduler
The Scheduler object within which the propagation task for the call messaging block is scheduled.

_PScheduleGroup
The ScheduleGroup object within which the propagation task for the call messaging block is scheduled. The Scheduler object used is implied by the schedule group.

Remarks

The runtime uses the default scheduler if you do not specify the _PScheduler or _PScheduleGroup parameters.

The type _Call_method is a functor with signature void (T const &) which is invoked by this call messaging block to process a message.

The type filter_method is a functor with signature bool (T const &) which is invoked by this call messaging block to determine whether or not it should accept an offered message.

~call

Destroys the call messaging block.

~call();

process_input_messages

Executes the call function on the input messages.

virtual void process_input_messages(_Inout_ message<T>* _PMessage);

Parameters

_PMessage
A pointer to the message that is to be handled.

process_message

Processes a message that was accepted by this call messaging block.

virtual void process_message(_Inout_ message<T>* _PMessage);

Parameters

_PMessage
A pointer to the message that is to be handled.

propagate_message

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

virtual message_status propagate_message(
    _Inout_ message<T>* _PMessage,
    _Inout_ ISource<T>* _PSource);

Parameters

_PMessage
A pointer to the message object.

_PSource
A pointer to the source block offering the message.

Return Value

A message_status indication of what the target decided to do with the message.

send_message

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

virtual message_status send_message(
    _Inout_ message<T>* _PMessage,
    _Inout_ ISource<T>* _PSource);

Parameters

_PMessage
A pointer to the message object.

_PSource
A pointer to the source block offering the message.

Return Value

A message_status indication of what the target decided to do with the message.

supports_anonymous_source

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

virtual bool supports_anonymous_source();

Return Value

true because the block does not postpone offered messages.

See also

concurrency Namespace
transformer Class