STLdoc
STLdocumentation
|
The ISource
class is the interface for all source blocks. Source blocks propagate messages to ITarget
blocks.
More...
#include <agents.h>
Public Types | |
typedef _Type | source_type |
A type alias for _Type . More... | |
Public Member Functions | |
virtual | ~ISource () |
Destroys the ISource object. More... | |
virtual void | link_target (_Inout_ ITarget< _Type > *_PTarget)=0 |
When overridden in a derived class, links a target block to this ISource block. More... | |
virtual void | unlink_target (_Inout_ ITarget< _Type > *_PTarget)=0 |
When overridden in a derived class, unlinks a target block from this ISource block, if found to be previously linked. More... | |
virtual void | unlink_targets ()=0 |
When overridden in a derived class, unlinks all target blocks from this ISource block. More... | |
virtual message< _Type > * | accept (runtime_object_identity _MsgId, _Inout_ ITarget< _Type > *_PTarget)=0 |
When overridden in a derived class, accepts a message that was offered by this ISource block, transferring ownership to the caller. More... | |
virtual bool | reserve (runtime_object_identity _MsgId, _Inout_ ITarget< _Type > *_PTarget)=0 |
When overridden in a derived class, reserves a message previously offered by this ISource block. More... | |
virtual message< _Type > * | consume (runtime_object_identity _MsgId, _Inout_ ITarget< _Type > *_PTarget)=0 |
When overridden in a derived class, consumes a message previously offered by this ISource block and successfully reserved by the target, transferring ownership to the caller. More... | |
virtual void | release (runtime_object_identity _MsgId, _Inout_ ITarget< _Type > *_PTarget)=0 |
When overridden in a derived class, releases a previous successful message reservation. More... | |
virtual void | acquire_ref (_Inout_ ITarget< _Type > *_PTarget)=0 |
When overridden in a derived class, acquires a reference count on this ISource block, to prevent deletion. More... | |
virtual void | release_ref (_Inout_ ITarget< _Type > *_PTarget)=0 |
When overridden in a derived class, releases a reference count on this ISource block. More... | |
Protected Member Functions | |
void | _Invoke_link_source (ITarget< _Type > *_PLinkFrom) |
Links this source to a target. More... | |
void | _Invoke_unlink_source (ITarget< _Type > *_PUnlinkFrom) |
Unlinks this source from a target. More... | |
The ISource
class is the interface for all source blocks. Source blocks propagate messages to ITarget
blocks.
_Type | The data type of the payload within the messages produced by the source block. |
For more information, see Asynchronous Message Blocks.
typedef _Type Concurrency::ISource< _Type >::source_type |
A type alias for _Type .
|
inlinevirtual |
Destroys the ISource
object.
|
inlineprotected |
Links this source to a target.
_PLinkFrom | A pointer to the target. |
This function definition is required because ISource blocks need to call Target->link_source(), which is a private member of ITarget. ISource is declared as a friend class, so this is a way for derived classes of ISource to properly link/unlink their targets during link_target(), unlink_target() and unlink_targets()
|
inlineprotected |
Unlinks this source from a target.
_PUnlinkFrom | A pointer to the target. |
This function definition is required because ISource blocks need to call Target->unlink_source(), which is a private member of ITarget. ISource is declared as a friend class, so this is a way for derived classes of ISource to properly link/unlink their targets during link_target(), unlink_target() and unlink_targets()
|
pure virtual |
When overridden in a derived class, accepts a message that was offered by this ISource
block, transferring ownership to the caller.
_MsgId | The runtime_object_identity of the offered message object. |
_PTarget | A pointer to the target block that is calling the accept method. |
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.
Implemented in Concurrency::choice< _Type >, and Concurrency::source_block< _TargetLinkRegistry, _MessageProcessorType >.
|
pure virtual |
When overridden in a derived class, acquires a reference count on this ISource
block, to prevent deletion.
_PTarget | A pointer to the target block that is calling this method. |
This method is called by an ITarget
object that is being linked to this source during the link_target
method.
Implemented in Concurrency::choice< _Type >, Concurrency::source_block< _TargetLinkRegistry, _MessageProcessorType >, Concurrency::details::_AsyncOriginator< _Type >, Concurrency::details::_SyncOriginator< _Type >, and Concurrency::details::_AnonymousOriginator< _Type >.
|
pure virtual |
When overridden in a derived class, consumes a message previously offered by this ISource
block and successfully reserved by the target, transferring ownership to the caller.
_MsgId | The runtime_object_identity of the reserved message object. |
_PTarget | A pointer to the target block that is calling the consume method. |
message
object that the caller now has ownership of. The consume
method is similar to accept
, but must always be preceded by a call to reserve
that returned true
.
Implemented in Concurrency::choice< _Type >, and Concurrency::source_block< _TargetLinkRegistry, _MessageProcessorType >.
|
pure virtual |
When overridden in a derived class, links a target block to this ISource
block.
_PTarget | A pointer to the target block being linked to this ISource block. |
Implemented in Concurrency::choice< _Type >, and Concurrency::source_block< _TargetLinkRegistry, _MessageProcessorType >.
|
pure virtual |
When overridden in a derived class, releases a previous successful message reservation.
_MsgId | The runtime_object_identity of the reserved message object. |
_PTarget | A pointer to the target block that is calling the release method. |
Implemented in Concurrency::choice< _Type >, and Concurrency::source_block< _TargetLinkRegistry, _MessageProcessorType >.
|
pure virtual |
When overridden in a derived class, releases a reference count on this ISource
block.
_PTarget | A pointer to the target block that is calling this method. |
This method is called by an ITarget
object that is being unlinked from this source. The source block is allowed to release any resources reserved for the target block.
Implemented in Concurrency::choice< _Type >, Concurrency::source_block< _TargetLinkRegistry, _MessageProcessorType >, Concurrency::details::_AsyncOriginator< _Type >, Concurrency::details::_SyncOriginator< _Type >, and Concurrency::details::_AnonymousOriginator< _Type >.
|
pure virtual |
When overridden in a derived class, reserves a message previously offered by this ISource
block.
_MsgId | The runtime_object_identity of the offered message object. |
_PTarget | A pointer to the target block that is calling the reserve method. |
true
if the message was successfully reserved, false
otherwise. Reservations can fail for many reasons, including: the message was already reserved or accepted by another target, the source could deny reservations, and so forth. After you call reserve
, if it succeeds, you must call either consume
or release
in order to take or give up possession of the message, respectively.
Implemented in Concurrency::choice< _Type >, and Concurrency::source_block< _TargetLinkRegistry, _MessageProcessorType >.
|
pure virtual |
When overridden in a derived class, unlinks a target block from this ISource
block, if found to be previously linked.
_PTarget | A pointer to the target block being unlinked from this ISource block. |
Implemented in Concurrency::choice< _Type >, and Concurrency::source_block< _TargetLinkRegistry, _MessageProcessorType >.
|
pure virtual |
When overridden in a derived class, unlinks all target blocks from this ISource
block.
Implemented in Concurrency::multitype_join< _Type, _Jtype >, Concurrency::choice< _Type >, Concurrency::source_block< _TargetLinkRegistry, _MessageProcessorType >, Concurrency::source_block< single_link_registry< ITarget< std::vector< _Type > > >, _MessageProcessorType >, Concurrency::source_block< single_link_registry< ITarget< _Output > >, _MessageProcessorType >, Concurrency::source_block< single_link_registry< ITarget< size_t > >, _MessageProcessorType >, Concurrency::source_block< multi_link_registry< ITarget< agent_status > >, _MessageProcessorType >, Concurrency::source_block< single_link_registry< ITarget< _Type > > >, Concurrency::source_block< multi_link_registry< ITarget< _Type > >, _MessageProcessorType >, Concurrency::source_block< multi_link_registry< ITarget< size_t > >, _MessageProcessorType >, Concurrency::source_block< single_link_registry< ITarget< _Destination_type > >, _MessageProcessorType >, Concurrency::details::_AsyncOriginator< _Type >, Concurrency::details::_SyncOriginator< _Type >, and Concurrency::details::_AnonymousOriginator< _Type >.