STLdoc
STLdocumentation
|
The ITarget
class is the interface for all target blocks. Target blocks consume messages offered to them by ISource
blocks.
More...
#include <agents.h>
Public Types | |
typedef _Type | type |
A type alias for _Type . More... | |
typedef std::function< bool(_Type const &)> | filter_method |
The signature of any method used by the block that returns a bool value to determine whether an offered message should be accepted. More... | |
Public Member Functions | |
virtual | ~ITarget () |
Destroys the ITarget object. More... | |
virtual message_status | propagate (_Inout_opt_ message< _Type > *_PMessage, _Inout_opt_ ISource< _Type > *_PSource)=0 |
When overridden in a derived class, asynchronously passes a message from a source block to this target block. More... | |
virtual message_status | send (_Inout_ message< _Type > *_PMessage, _Inout_ ISource< _Type > *_PSource)=0 |
When overridden in a derived class, synchronously passes a message to the target block. More... | |
virtual bool | supports_anonymous_source () |
When overridden in a derived class, returns true or false depending on whether the message block accepts messages offered by a source that is not linked to it. If the overridden method returns true , the target cannot postpone an offered message, as consumption of a postponed message at a later time requires the source to be identified in its source link registry. More... | |
Protected Member Functions | |
virtual void | link_source (_Inout_ ISource< _Type > *_PSource)=0 |
When overridden in a derived class, links a specified source block to this ITarget block. More... | |
virtual void | unlink_source (_Inout_ ISource< _Type > *_PSource)=0 |
When overridden in a derived class, unlinks a specified source block from this ITarget block. More... | |
virtual void | unlink_sources ()=0 |
When overridden in a derived class, unlinks all source blocks from this ITarget block. More... | |
Friends | |
class | ISource< _Type > |
The ITarget
class is the interface for all target blocks. Target blocks consume messages offered to them by ISource
blocks.
_Type | The data type of the payload within the messages accepted by the target block. |
For more information, see Asynchronous Message Blocks.
typedef std::function<bool(_Type const&)> Concurrency::ITarget< _Type >::filter_method |
The signature of any method used by the block that returns a bool
value to determine whether an offered message should be accepted.
typedef _Type Concurrency::ITarget< _Type >::type |
A type alias for _Type .
|
inlinevirtual |
Destroys the ITarget
object.
|
protectedpure virtual |
When overridden in a derived class, links a specified source block to this ITarget
block.
This function should not be called directly on an ITarget
block. Blocks should be connected together using the link_target
method on ISource
blocks, which will invoke the link_source
method on the corresponding target.
Implemented in Concurrency::propagator_block< _TargetLinkRegistry, _SourceLinkRegistry, _MessageProcessorType >, and Concurrency::target_block< _SourceLinkRegistry, _MessageProcessorType >.
|
pure virtual |
When overridden in a derived class, asynchronously passes a message from a source block to this target block.
_PMessage | A pointer to the message object. |
_PSource | A pointer to the source block offering the message. |
The method throws an invalid_argument exception if either the _PMessage or _PSource parameter is NULL
.
Implemented in Concurrency::propagator_block< _TargetLinkRegistry, _SourceLinkRegistry, _MessageProcessorType >, and Concurrency::target_block< _SourceLinkRegistry, _MessageProcessorType >.
|
pure virtual |
When overridden in a derived class, synchronously passes a message to the target block.
_PMessage | A pointer to the message object. |
_PSource | A pointer to the source block offering the message. |
The method throws an invalid_argument exception if either the _PMessage or _PSource parameter is NULL
.
Using the send
method outside of message initiation and to propagate messages within a network is dangerous and can lead to deadlock.
When send
returns, the message has either already been accepted, and transferred into the target block, or it has been declined by the target.
Implemented in Concurrency::propagator_block< _TargetLinkRegistry, _SourceLinkRegistry, _MessageProcessorType >, and Concurrency::target_block< _SourceLinkRegistry, _MessageProcessorType >.
|
inlinevirtual |
When overridden in a derived class, returns true or false depending on whether the message block accepts messages offered by a source that is not linked to it. If the overridden method returns true
, the target cannot postpone an offered message, as consumption of a postponed message at a later time requires the source to be identified in its source link registry.
true
if the block can accept message from a source that is not linked to it false
otherwise. Reimplemented in Concurrency::transformer< _Input, _Output >, Concurrency::call< _Type, _FunctorType >, Concurrency::overwrite_buffer< _Type >, Concurrency::overwrite_buffer< agent_status >, and Concurrency::unbounded_buffer< _Type >.
|
protectedpure virtual |
When overridden in a derived class, unlinks a specified source block from this ITarget
block.
This function should not be called directly on an ITarget
block. Blocks should be disconnected using the unlink_target
or unlink_targets
methods on ISource
blocks, which will invoke the unlink_source
method on the corresponding target.
Implemented in Concurrency::propagator_block< _TargetLinkRegistry, _SourceLinkRegistry, _MessageProcessorType >, and Concurrency::target_block< _SourceLinkRegistry, _MessageProcessorType >.
|
protectedpure virtual |
When overridden in a derived class, unlinks all source blocks from this ITarget
block.
Implemented in Concurrency::propagator_block< _TargetLinkRegistry, _SourceLinkRegistry, _MessageProcessorType >, Concurrency::propagator_block< multi_link_registry< ITarget< size_t > >, multi_link_registry< ISource< size_t > > >, Concurrency::propagator_block< multi_link_registry< ITarget< _Type > >, multi_link_registry< ISource< _Type > > >, Concurrency::propagator_block< single_link_registry< ITarget< std::vector< _Type > > >, multi_link_registry< ISource< _Type > > >, Concurrency::propagator_block< single_link_registry< ITarget< _Destination_type > >, multi_link_registry< ISource< size_t > > >, Concurrency::propagator_block< single_link_registry< ITarget< size_t > >, multi_link_registry< ISource< _Type > > >, Concurrency::propagator_block< multi_link_registry< ITarget< agent_status > >, multi_link_registry< ISource< agent_status > > >, Concurrency::propagator_block< single_link_registry< ITarget< _Output > >, multi_link_registry< ISource< _Input > > >, Concurrency::target_block< _SourceLinkRegistry, _MessageProcessorType >, and Concurrency::target_block< multi_link_registry< ISource< _Type > > >.