Класс joinjoin Class
Блок обмена сообщениями join
— это упорядоченный блок propagator_block
с несколькими источниками и одной целью, который объединяет сообщения типа T
от каждого из своих источников.A join
messaging block is a single-target, multi-source, ordered propagator_block
which combines together messages of type T
from each of its sources.
СинтаксисSyntax
template<class T,
join_type _Jtype = non_greedy>
class join : public propagator_block<single_link_registry<ITarget<std::vector<T>>>,
multi_link_registry<ISource<T>>>;
ПараметрыParameters
TT
Тип полезных данных сообщений, соединяемых и распространяемых блоком.The payload type of the messages joined and propagated by the block.
_Jtype_Jtype
Тип join
блока: greedy
или non_greedy
The kind of join
block this is, either greedy
or non_greedy
ЭлементыMembers
Открытые конструкторыPublic Constructors
nameName | Описание:Description |
---|---|
joinjoin | Перегружен.Overloaded. Создает блок обмена сообщениями join .Constructs a join messaging block. |
Деструктор ~ Join~join Destructor | Уничтожает join блок.Destroys the join block. |
Защищенные методыProtected Methods
ИмяName | ОписаниеDescription |
---|---|
accept_messageaccept_message | Принимает сообщение, которое было предложено этим join блоком обмена сообщениями, передавая владение вызывающему объекту.Accepts a message that was offered by this join messaging block, transferring ownership to the caller. |
consume_messageconsume_message | Использует сообщение, которое было ранее предложено join блоком обмена сообщениями и зарезервировано целевым объектом, передавая владение вызывающему объекту.Consumes a message previously offered by the join messaging block and reserved by the target, transferring ownership to the caller. |
link_target_notificationlink_target_notification | Обратный вызов, уведомляющий о том, что новый целевой объект связан с этим join блоком обмена сообщениями.A callback that notifies that a new target has been linked to this join messaging block. |
propagate_messagepropagate_message | Асинхронно передает сообщение из ISource блока в этот join блок обмена сообщениями.Asynchronously passes a message from an ISource block to this join messaging block. Он вызывается propagate методом при вызове из исходного блока.It is invoked by the propagate method, when called by a source block. |
propagate_to_any_targetspropagate_to_any_targets | Формирует выходное сообщение, содержащее входное сообщение из каждого источника, когда все они распространяют сообщение.Constructs an output message containing an input message from each source when they have all propagated a message. Отправляет это выходное сообщение в все целевые объекты.Sends this output message out to each of its targets. |
release_messagerelease_message | Освобождает предыдущее резервирование сообщения.Releases a previous message reservation. (Переопределяет source_block:: release_message.)(Overrides source_block::release_message.) |
reserve_messagereserve_message | Резервирует сообщение, которое было ранее предложено этим join блоком обмена сообщениями.Reserves a message previously offered by this join messaging block. (Переопределяет source_block:: reserve_message.)(Overrides source_block::reserve_message.) |
resume_propagationresume_propagation | Возобновляет распространение после освобождения резервирования.Resumes propagation after a reservation has been released. (Переопределяет source_block:: resume_propagation.)(Overrides source_block::resume_propagation.) |
КомментарииRemarks
Дополнительные сведения см. в разделе асинхронные блоки сообщений.For more information, see Asynchronous Message Blocks.
Иерархия наследованияInheritance Hierarchy
propagator_blockpropagator_block
join
ТребованияRequirements
Заголовок: agents.hHeader: agents.h
Пространство имен: параллелизмNamespace: concurrency
accept_messageaccept_message
Принимает сообщение, которое было предложено этим join
блоком обмена сообщениями, передавая владение вызывающему объекту.Accepts a message that was offered by this join
messaging block, transferring ownership to the caller.
virtual message<_OutputType>* accept_message(runtime_object_identity _MsgId);
ПараметрыParameters
_MsgId_MsgId
runtime_object_identity
Объект предлагаемого message
объекта.The runtime_object_identity
of the offered message
object.
Возвращаемое значениеReturn Value
Указатель на message
объект, владельцем которого стал вызывающий объект.A pointer to the message
object that the caller now has ownership of.
consume_messageconsume_message
Использует сообщение, которое было ранее предложено join
блоком обмена сообщениями и зарезервировано целевым объектом, передавая владение вызывающему объекту.Consumes a message previously offered by the join
messaging block and reserved by the target, transferring ownership to the caller.
virtual message<_OutputType>* consume_message(runtime_object_identity _MsgId);
ПараметрыParameters
_MsgId_MsgId
runtime_object_identity
Объект для используемого message
объекта.The runtime_object_identity
of the message
object being consumed.
Возвращаемое значениеReturn Value
Указатель на message
объект, владельцем которого стал вызывающий объект.A pointer to the message
object that the caller now has ownership of.
КомментарииRemarks
Аналогично accept
, но всегда предшествует вызову reserve
.Similar to accept
, but is always preceded by a call to reserve
.
кjoin
Создает блок обмена сообщениями join
.Constructs a join
messaging block.
join(
size_t _NumInputs);
join(
size_t _NumInputs,
filter_method const& _Filter);
join(
Scheduler& _PScheduler,
size_t _NumInputs);
join(
Scheduler& _PScheduler,
size_t _NumInputs,
filter_method const& _Filter);
join(
ScheduleGroup& _PScheduleGroup,
size_t _NumInputs);
join(
ScheduleGroup& _PScheduleGroup,
size_t _NumInputs,
filter_method const& _Filter);
ПараметрыParameters
_NumInputs_NumInputs
Число входов, join
разрешенных для этого блока.The number of inputs this join
block will be allowed.
_Filter_Filter
Функция фильтра, которая определяет, следует ли принимать предлагаемые сообщения.A filter function which determines whether offered messages should be accepted.
_PScheduler_PScheduler
Объект Scheduler
, в котором запланирована задача распространения для блока обмена сообщениями join
.The Scheduler
object within which the propagation task for the join
messaging block is scheduled.
_PScheduleGroup_PScheduleGroup
Объект ScheduleGroup
, в котором запланирована задача распространения для блока обмена сообщениями join
.The ScheduleGroup
object within which the propagation task for the join
messaging block is scheduled. Используемый объект Scheduler
подразумевается группой расписаний.The Scheduler
object used is implied by the schedule group.
КомментарииRemarks
Среда выполнения использует планировщик по умолчанию, если вы не указали параметры _PScheduler
или _PScheduleGroup
.The runtime uses the default scheduler if you do not specify the _PScheduler
or _PScheduleGroup
parameters.
Тип filter_method
— это функтор с сигнатурой, bool (T const &)
которая вызывается этим join
блоком обмена сообщениями для определения того, следует ли принимать предложенное сообщение.The type filter_method
is a functor with signature bool (T const &)
which is invoked by this join
messaging block to determine whether or not it should accept an offered message.
~ соединение~join
Уничтожает join
блок.Destroys the join
block.
~join();
link_target_notificationlink_target_notification
Обратный вызов, уведомляющий о том, что новый целевой объект связан с этим join
блоком обмена сообщениями.A callback that notifies that a new target has been linked to this join
messaging block.
virtual void link_target_notification(_Inout_ ITarget<std::vector<T>> *);
propagate_messagepropagate_message
Асинхронно передает сообщение из ISource
блока в этот join
блок обмена сообщениями.Asynchronously passes a message from an ISource
block to this join
messaging block. Он вызывается propagate
методом при вызове из исходного блока.It is invoked by the propagate
method, when called by a source block.
message_status propagate_message(
_Inout_ message<T>* _PMessage,
_Inout_ ISource<T>* _PSource);
ПараметрыParameters
_PMessage_PMessage
Указатель на объект message
.A pointer to the message
object.
_PSource_PSource
Указатель на исходный блок, предлагающий сообщение.A pointer to the source block offering the message.
Возвращаемое значениеReturn Value
Message_status указывает, что цель решила делать с сообщением.A message_status indication of what the target decided to do with the message.
propagate_to_any_targetspropagate_to_any_targets
Формирует выходное сообщение, содержащее входное сообщение из каждого источника, когда все они распространяют сообщение.Constructs an output message containing an input message from each source when they have all propagated a message. Отправляет это выходное сообщение в все целевые объекты.Sends this output message out to each of its targets.
void propagate_to_any_targets(_Inout_opt_ message<_OutputType> *);
release_messagerelease_message
Освобождает предыдущее резервирование сообщения.Releases a previous message reservation.
virtual void release_message(runtime_object_identity _MsgId);
ПараметрыParameters
_MsgId_MsgId
runtime_object_identity
message
Объект для освобожденного объекта.The runtime_object_identity
of the message
object being released.
reserve_messagereserve_message
Резервирует сообщение, которое было ранее предложено этим join
блоком обмена сообщениями.Reserves a message previously offered by this join
messaging block.
virtual bool reserve_message(runtime_object_identity _MsgId);
ПараметрыParameters
_MsgId_MsgId
runtime_object_identity
Объект предлагаемого message
объекта.The runtime_object_identity
of the offered message
object.
Возвращаемое значениеReturn Value
true
значение, если сообщение было успешно зарезервировано, false
в противном случае.true
if the message was successfully reserved, false
otherwise.
КомментарииRemarks
После reserve
вызова метода, если он возвращает значение true
, consume
release
метод или должен быть вызван, чтобы принять или освободить владение сообщением.After reserve
is called, if it returns true
, either consume
or release
must be called to either take or release ownership of the message.
resume_propagationresume_propagation
Возобновляет распространение после освобождения резервирования.Resumes propagation after a reservation has been released.
virtual void resume_propagation();
См. также разделSee also
Пространство имен Concurrencyconcurrency Namespace
Класс choicechoice Class
Класс multitype_joinmultitype_join Class