31 #pragma pack(push,_CRT_PACKING)
33 #pragma warning(disable: 4100) // Unreferenced formal parameter - needed for document generation
34 #pragma warning(disable: 4702) // Unreachable code - needed for retail version code path
35 #pragma warning(disable: 4297) // Function expected not to throw but does
58 typedef ::Concurrency::details::_NonReentrantPPLLock::_Scoped_lock
_NR_lock;
65 typedef ::Concurrency::details::_ReentrantPPLLock::_Scoped_lock
_R_lock;
105 template<
class _Message>
145 *_M_ppTail = _Element;
146 _Element->_M_pNext =
NULL;
147 _M_ppTail = &(_Element->_M_pNext);
162 if (_M_pHead == _OldElement)
164 _M_pHead = _OldElement->_M_pNext;
165 if (_M_pHead ==
NULL)
170 _OldElement->_M_pNext =
NULL;
176 _Message * _Next =
NULL;
177 for (_Message * _Node = _M_pHead; _Node !=
NULL; _Node = _Next)
179 _Next = _Node->_M_pNext;
181 if (_Node->_M_pNext == _OldElement)
183 _Node->_M_pNext = _OldElement->_M_pNext;
185 if (_Node->_M_pNext ==
NULL && _M_count == 1)
190 _OldElement->_M_pNext =
NULL;
206 if (_M_pHead ==
NULL)
213 _M_pHead = _Result->_M_pNext;
214 if (_M_pHead ==
NULL)
219 _Result->_M_pNext =
NULL;
239 if (_Msg ==
NULL || _Msg->msg_id() != _MsgId)
254 template<
class _Type>
295 for (
size_t _I=0; _I <
_Size; _I++)
404 for (
size_t _I = 0; _I <
_M_size; _I++)
434 template <
class _Type>
437 return reinterpret_cast<__int64
>(_PObject);
470 template<
class _Block>
595 template<
class _Block>
659 virtual bool remove(_EType
_Link) = 0;
683 virtual size_t count() = 0;
696 virtual iterator
begin() = 0;
733 template<
class _Block>
908 template<
class _Block>
1060 while (_Index < _Size)
1104 size_t _Insert_pos = 0;
1121 _Insert_pos =
_Index + 1;
1131 if (_Insert_pos < _Size)
1189 for (_Index = 0; _Index <
_M_vector._Size(); _Index++)
1241 template<
class _LinkRegistry>
1377 const_reference
_Get(
size_t _Pos)
const
1418 template<
class _LinkRegistry>
1474 typedef ::Concurrency::details::_ReentrantPPLLock
_LockType;
1571 bool _Removed =
false;
1572 _EType _RemovedLink =
NULL;
1594 _RemovedLink =
_Link;
1606 if (_RemovedLink !=
NULL)
1608 _RemovedLink->release_ref(_LinkedTarget);
1653 for (
size_t _I=0; _I <
_Size; _I++)
1655 _LinksToRemove[_I]->release_ref(_LinkedTarget);
1775 template<
class _Type>
1778 friend class ::Concurrency::details::_Queue<message<_Type>>;
1844 throw std::invalid_argument(
"_Msg");
1929 template<
class _Type>
1970 virtual void wait() = 0;
2008 template<
class _Type>
2158 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
2171 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
2277 long _Messages_processed = 0;
2282 bool _StopProcessing =
false;
2290 _Messages_processed +=
_Count;
2293 volatile long _Orig = _InterlockedExchangeAdd((
volatile long *) &
_M_queuedDataCount, -_Count);
2295 if (_Orig == _Count)
2301 if (_StopProcessing)
2315 return _Messages_processed;
2323 for(
int _I = 0; _I <
_Count; _I++)
2449 template<
class _Type>
2597 template<
class _Type>
2807 template <
class _Type>
2811 class _Blocking_recipient :
public ITarget<_Type>
2817 _M_pFilter(
NULL), _M_pConnectedTo(
NULL), _M_pMessage(
NULL), _M_fState(_NotInitialized), _M_timeout(_Timeout)
2826 _M_pFilter(
NULL), _M_pConnectedTo(
NULL), _M_pMessage(
NULL), _M_fState(_NotInitialized), _M_timeout(_Timeout)
2828 if (_Filter !=
NULL)
2837 ~_Blocking_recipient()
2849 _Wait_for_message();
2851 return _M_pMessage->payload;
2859 if (_PMessage ==
NULL)
2861 throw std::invalid_argument(
"_PMessage");
2864 if (_PSource ==
NULL)
2866 throw std::invalid_argument(
"_PSource");
2870 if (_M_fState == _Initialized)
2876 if (_M_pFilter !=
NULL && !(*_M_pFilter)(_PMessage->
payload))
2883 _M_pMessage = _PSource->
accept(_PMessage->
msg_id(),
this);
2885 if (_M_pMessage !=
NULL)
2888 if (_InterlockedExchange(&_M_fState, _Initialized) == _Blocked)
2903 if (_PMessage ==
NULL)
2905 throw std::invalid_argument(
"_PMessage");
2908 if (_PSource ==
NULL)
2910 throw std::invalid_argument(
"_PSource");
2925 _M_pConnectedTo =
_PSrc;
2939 virtual void unlink_sources()
2941 ISource<_Type> * _PSource =
reinterpret_cast<ISource<_Type> *
>(_InterlockedExchangePointer(reinterpret_cast<void *volatile *>(&_M_pConnectedTo), (
void *)
NULL));
2942 if (_PSource !=
NULL)
2953 if (_PSource ==
NULL)
2955 throw std::invalid_argument(
"_PSource");
2970 void _Wait_for_message()
2972 bool _Timeout =
false;
2986 if (_M_fState != _Initialized)
3004 volatile long _M_fState;
3013 unsigned int _M_timeout;
3022 if (_Filter_proc !=
NULL)
3024 _Blocking_recipient _Recipient(_Src, *_Filter_proc, _Timeout);
3025 return _Recipient._Value();
3029 _Blocking_recipient _Recipient(_Src, _Timeout);
3030 return _Recipient._Value();
3062 template <
class _Type>
3099 template <
class _Type>
3133 template <
class _Type>
3170 template <
class _Type>
3198 template <
class _Type>
3202 class _Immediate_recipient :
public ITarget<_Type>
3207 _M_pFilter(
NULL), _M_pConnectedTo(
NULL), _M_pMessage(
NULL), _M_isInitialized(0)
3215 _M_pFilter(
NULL), _M_pConnectedTo(
NULL), _M_pMessage(
NULL), _M_isInitialized(0)
3217 if (_Filter !=
NULL)
3226 ~_Immediate_recipient()
3240 if (_M_pMessage !=
NULL)
3242 _value = _M_pMessage->payload;
3256 if (_PMessage ==
NULL)
3258 throw std::invalid_argument(
"_PMessage");
3261 if (_PSource ==
NULL)
3263 throw std::invalid_argument(
"_PSource");
3267 if (_M_isInitialized == 1)
3273 if (_M_pFilter !=
NULL && !(*_M_pFilter)(_PMessage->
payload))
3280 _M_pMessage = _PSource->
accept(_PMessage->
msg_id(),
this);
3284 if (_M_pMessage !=
NULL)
3287 _InterlockedExchange(&_M_isInitialized, 1);
3303 if (_PMessage ==
NULL)
3305 throw std::invalid_argument(
"_PMessage");
3308 if (_PSource ==
NULL)
3310 throw std::invalid_argument(
"_PSource");
3325 _M_pConnectedTo =
_PSrc;
3339 virtual void unlink_sources()
3341 ISource<_Type> * _PSource =
reinterpret_cast<ISource<_Type> *
>(_InterlockedExchangePointer(reinterpret_cast<void *volatile *>(&_M_pConnectedTo), (
void *)
NULL));
3342 if (_PSource !=
NULL)
3352 if (_PSource ==
NULL)
3354 throw std::invalid_argument(
"_PSource");
3378 volatile long _M_isInitialized;
3384 if (_Filter_proc !=
NULL)
3386 _Immediate_recipient _Recipient(_Src, *_Filter_proc);
3387 return _Recipient._Value(_value);
3391 _Immediate_recipient _Recipient(_Src);
3392 return _Recipient._Value(_value);
3420 template <
class _Type>
3453 template <
class _Type>
3483 template <
class _Type>
3516 template <
class _Type>
3529 template <
class _Type>
3550 throw invalid_operation(
"unlink_target is not supported on _AnonymousOriginator");
3556 throw invalid_operation(
"unlink_targets is not supported on _AnonymousOriginator");
3606 throw invalid_operation(
"acquire_ref is not supported on _AnonymousOriginator");
3611 throw invalid_operation(
"release_ref is not supported on _AnonymousOriginator");
3666 throw invalid_operation(
"Messages offered by _AnonymousOriginator shall not be postponed");
3675 throw invalid_operation(
"link_target is not supported on _AnonymousOriginator");
3686 template <
class _Type>
3714 if (_PTarget ==
NULL)
3716 throw std::invalid_argument(
"_PTarget");
3759 if (_PTarget ==
NULL)
3793 if (_PTarget ==
NULL)
3795 throw std::invalid_argument(
"_PTarget");
3815 if (_PTarget ==
NULL)
3817 throw std::invalid_argument(
"_PTarget");
3825 return accept(_MsgId, _PTarget);
3833 if (_PTarget ==
NULL)
3835 throw std::invalid_argument(
"_PTarget");
3871 if (_PTarget ==
NULL)
3873 throw std::invalid_argument(
"_PTarget");
3913 if (_PTarget ==
NULL)
3915 throw std::invalid_argument(
"_PTarget");
3973 template <
class _Type>
3991 if (_PTarget ==
NULL)
3993 throw std::invalid_argument(
"_PTarget");
3996 bool _Unlinked =
false;
4020 bool _Unlinked =
false;
4055 if (_PTarget ==
NULL)
4084 if (_PTarget ==
NULL)
4086 throw std::invalid_argument(
"_PTarget");
4106 if (_PTarget ==
NULL)
4108 throw std::invalid_argument(
"_PTarget");
4138 if (_PTarget ==
NULL)
4140 throw std::invalid_argument(
"_PTarget");
4220 if (_PTarget ==
NULL)
4222 throw std::invalid_argument(
"_PTarget");
4272 template <
class _Type>
4293 template <
class _Type>
4336 template <
class _Type>
4365 template <
class _Type>
4393 template <
class _Type>
4422 template <
class _Type>
4444 template<
class _SourceLinkRegistry,
4445 class _MessageProcessorType = ordered_message_processor<typename _SourceLinkRegistry::type::source_type>>
4517 if (_PMessage ==
NULL)
4519 throw std::invalid_argument(
"_PMessage");
4522 if (_PSource ==
NULL)
4524 throw std::invalid_argument(
"_PSource");
4564 if (_PMessage ==
NULL)
4566 throw std::invalid_argument(
"_PMessage");
4569 if (_PSource ==
NULL)
4571 throw std::invalid_argument(
"_PSource");
4707 if (_Filter !=
NULL)
4828 throw invalid_operation(
"To use batched processing, you must override process_input_messages in the message block.");
4877 template<
class _TargetLinkRegistry,
4936 if (_PTarget ==
NULL)
4938 throw std::invalid_argument(
"_PTarget");
4961 if (_PTarget ==
NULL)
4963 throw std::invalid_argument(
"_PTarget");
5018 if (_PTarget ==
NULL)
5020 throw std::invalid_argument(
"_PTarget");
5056 if (_PTarget ==
NULL)
5058 throw std::invalid_argument(
"_PTarget");
5112 if (_PTarget ==
NULL)
5114 throw std::invalid_argument(
"_PTarget");
5161 if (_PTarget ==
NULL)
5163 throw std::invalid_argument(
"_PTarget");
5210 if (_PTarget !=
NULL)
5351 throw invalid_operation(
"To use batched processing, you must override propagate_output_messages in the message block.");
5365 throw invalid_operation(
"To use ordered message processing, you must override propagate_to_any_targets in the message block.");
5576 template<
class _TargetLinkRegistry,
class _SourceLinkRegistry,
5647 if (_PMessage ==
NULL)
5649 throw std::invalid_argument(
"_PMessage");
5652 if (_PSource ==
NULL)
5654 throw std::invalid_argument(
"_PSource");
5691 if (_PMessage ==
NULL)
5693 throw std::invalid_argument(
"_PMessage");
5696 if (_PSource ==
NULL)
5698 throw std::invalid_argument(
"_PSource");
5811 throw invalid_operation(
"To use batched processing, you must override process_input_messages in the message block.");
5844 if (_Filter !=
NULL)
5917 template<
class _Type>
5973 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
6102 return ::Concurrency::send<_Type>(
this, _Item);
6114 return ::Concurrency::receive<_Type>(
this);
6148 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
6150 if (_PMessage !=
NULL)
6179 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
6181 if (_PMessage !=
NULL)
6349 if (_PMessage !=
NULL)
6381 if(_PInputMessage ==
NULL)
6419 while (_Msg !=
NULL)
6427 _Status = _PTarget->
propagate(_Msg,
this);
6453 _Msg = _MessageBuffer._Peek();
6526 template<
class _Type>
6579 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
6719 return ::Concurrency::receive<_Type>(
this);
6751 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
6757 if (_PMessage !=
NULL)
6760 _PMessage->add_ref();
6789 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
6795 if (_PMessage !=
NULL)
6798 _PMessage->add_ref();
7007 _PMessage->add_ref();
7031 if (_PMessage->remove_ref() == 0)
7111 template<
class _Type,
class _FunctorType = std::function<
void(_Type const&)>>
7178 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
7200 call(Scheduler& _PScheduler,
7201 _Call_method
const& _Func) :
7232 call(Scheduler& _PScheduler,
7233 _Call_method
const& _Func,
7264 call(ScheduleGroup& _PScheduleGroup,
7265 _Call_method
const& _Func) :
7297 call(ScheduleGroup& _PScheduleGroup,
7298 _Call_method
const& _Func,
7352 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
7354 if (_PMessage !=
NULL)
7391 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
7393 if (_PMessage !=
NULL)
7480 template<
class _Input,
class _Output>
7520 if (_PTarget !=
NULL)
7558 if (_PTarget !=
NULL)
7564 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
7590 _Transform_method
const& _Func,
7596 if (_PTarget !=
NULL)
7630 _Transform_method
const& _Func,
7638 if (_PTarget !=
NULL)
7670 _Transform_method
const& _Func,
7676 if (_PTarget !=
NULL)
7711 _Transform_method
const& _Func,
7719 if (_PTarget !=
NULL)
7772 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
7774 if (_PMessage !=
NULL)
7805 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
7807 if (_PMessage !=
NULL)
7962 if (_PInputMessage !=
NULL)
7973 delete _PInputMessage;
8003 while (_Msg !=
NULL)
8011 _Status = _PTarget->
propagate(_Msg,
this);
8037 _Msg = _MessageBuffer._Peek();
8056 delete _PInputQueueMessage;
8110 template<
class _Type>
8178 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
8208 _Initialize(_Value, _PTarget, _Repeating, &_Scheduler);
8516 _M_fRepeating = _Repeating;
8518 _M_fReferencedScheduler =
false;
8525 if (_PScheduleGroup ==
NULL && _PScheduler ==
NULL)
8530 _M_fReferencedScheduler =
true;
8533 _M_pScheduler = _PScheduler;
8536 if (_PTarget !=
NULL)
8555 if (_M_pMessage !=
NULL)
8588 template<
class _Type>
8642 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
8782 ::Concurrency::receive<_Type>(
this);
8830 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
8833 if (_PMessage !=
NULL)
8890 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
8893 if (_PMessage !=
NULL)
9153 template<
class _Type, join_type _Jtype = non_greedy>
9154 class join :
public propagator_block<single_link_registry<ITarget<std::vector<_Type>>>, multi_link_registry<ISource<_Type>>>
9218 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
9238 join(Scheduler& _PScheduler,
size_t _NumInputs)
9295 join(ScheduleGroup& _PScheduleGroup,
size_t _NumInputs)
9325 join(ScheduleGroup& _PScheduleGroup,
size_t _NumInputs,
filter_method const& _Filter)
9381 bool _Found =
false;
9384 if (*_Iter == _PSource)
9402 bool fIsGreedy = (_Jtype ==
greedy);
9603 bool fIsGreedy = (_Jtype ==
greedy);
9618 runtime_object_identity _Saved_id;
9630 if (_Saved_id == -1)
9641 if (_Saved_id != -1)
9646 if ((_PSource !=
NULL) && _PSource->
reserve(_Saved_id,
this))
9700 while (_Msg !=
NULL)
9708 _Status = _PTarget->
propagate(_Msg,
this);
9734 _Msg = _MessageBuffer._Peek();
9755 std::vector<ISource<_Type> *> _Sources;
9758 while (*_Iter !=
NULL)
9762 if (_PSource ==
NULL)
9767 _Sources.push_back(_PSource);
9793 for (
size_t j = 0; j <
i; j++)
9827 std::vector<_Type> _OutputVector;
9839 return (
new message<std::vector<_Type>>(_OutputVector));
9871 memset(
_M_savedIdBuffer, -1,
sizeof(runtime_object_identity) * _NumInputs);
9914 : _M_count(_NumInputs),
9923 delete _M_messages[
i];
9941 : _M_count(_NumInputs),
9942 _M_savedIds(new runtime_object_identity[_NumInputs])
9944 memset(_M_savedIds, -1,
sizeof(runtime_object_identity) * _NumInputs);
9979 template<
class _Type>
10042 virtual void _Reset() = 0;
10143 if (_PSource ==
NULL)
10145 throw std::invalid_argument(
"_PSource");
10156 if (_PTarget !=
NULL)
10195 template<
class _Type>
10472 if (_PSource ==
NULL)
10535 if (_PSource !=
NULL)
10583 template<
class _Type>
10789 runtime_object_identity _Saved_id;
10796 if (_Saved_id == -1)
10807 if (_Saved_id != -1)
10812 if ((_PSource !=
NULL) && _PSource->
reserve(_Saved_id,
this))
10852 bool _FDone =
false;
10977 template<
class _Type>
11191 bool _Ret_val =
false;
11199 if (_PSource !=
NULL)
11202 runtime_object_identity _SavedId = _InterlockedExchange((
volatile long *) &
_M_savedId, -1);
11204 _Ret_val = _PSource->
reserve(_SavedId,
this);
11238 runtime_object_identity _OldId =
NULL;
11239 _OldId = _InterlockedExchange((
volatile long *) &
_M_reservedId, -1);
11255 bool retVal =
false;
11305 if (_InterlockedExchange((
volatile long *) &
_M_savedId, _PMessage->
msg_id()) == -1)
11421 template<
class _Type>
11449 _Initialize_choices<0>();
11452 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
11479 _Initialize_choices<0>();
11509 _Initialize_choices<0>();
11543 _Choice._M_pSingleAssignment =
NULL;
11560 _Delete_choices<0>();
11612 template <
typename _Payload_type>
11772 template<
int _Index>
11780 template<
int _Index>
11783 std::tuple_element_t<_Index, _Type> _Item = std::get<_Index>(
_M_sourceTuple);
11801 _Initialize_choices<_Index + 1>();
11809 template<>
void _Initialize_choices<std::tuple_size<_Type>::value>()
11818 template<
int _Index>
11823 _Delete_choices<_Index + 1>();
11831 template<>
void _Delete_choices<std::tuple_size<_Type>::value>()
11860 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
11892 template<
typename _Type1,
typename _Type2,
typename... _Types>
11893 choice<std::tuple<_Type1, _Type2, _Types...>>
11894 make_choice(Scheduler& _PScheduler, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
11896 return choice<std::tuple<_Type1, _Type2, _Types...>>(_PScheduler,
std::make_tuple(_Item1, _Item2, _Items...));
11931 template<
typename _Type1,
typename _Type2,
typename... _Types>
11932 choice<std::tuple<_Type1, _Type2, _Types...>>
11933 make_choice(ScheduleGroup& _PScheduleGroup, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
11935 return choice<std::tuple<_Type1, _Type2, _Types...>>(_PScheduleGroup,
std::make_tuple(_Item1, _Item2, _Items...));
11967 template<
typename _Type1,
typename _Type2,
typename... _Types>
11968 choice<std::tuple<_Type1, _Type2, _Types...>>
11990 template <
typename... _Types>
11993 typedef std::tuple<typename std::remove_pointer_t<_Types>::source_type...>
type;
12007 template<
typename _Type,
typename _Destination_type, join_type _Jtype>
12091 _PMessage = _PSource->
accept(_PMessage->
msg_id(),
this);
12253 _InterlockedExchange(&
_M_counter, std::tuple_size<_Destination_type>::value);
12286 template<
int _Index>
12290 _Non_greedy_node_source_type * _Node =
static_cast<_Non_greedy_node_source_type *
>(_Sources[
_Index]);
12295 if (_Node->_Reserve_received_message())
12297 bool _Ret_val = _Try_consume_source_messages<_Index + 1>(_Destination_tuple, _Sources);
12301 _Node->_Consume_received_message();
12305 if (_Node->_Release_received_message())
12330 template<>
bool _Try_consume_source_messages<std::tuple_size<_Type>::value>(_Destination_type &,
ISource<size_t> **)
12346 _Destination_type _Destination_tuple;
12355 while (*_Iter !=
NULL)
12359 if (_PSource ==
NULL)
12365 if (_Index >= std::tuple_size<_Type>::value)
12379 if (_Index != std::tuple_size<_Type>::value)
12386 bool _IsAcquireSuccessful = _Try_consume_source_messages<0>(_Destination_tuple, _Sources);
12388 return _IsAcquireSuccessful;
12408 while (_Msg !=
NULL)
12416 _Status = _PTarget->
propagate(_Msg,
this);
12442 _Msg = _MessageBuffer._Peek();
12453 _Destination_type _Destination_tuple;
12462 while (*_Iter !=
NULL)
12466 if (_PSource ==
NULL)
12473 if (_Index >= std::tuple_size<_Type>::value)
12479 _Sources[
_Index] = *_Iter;
12486 if (_Index != std::tuple_size<_Type>::value)
12493 _Populate_destination_tuple<0>(_Destination_tuple, _Sources);
12521 template<
int _Index>
12525 _Order_node_base_source_type * _Node =
static_cast<_Order_node_base_source_type *
>(_Sources[
_Index]);
12527 std::get<_Index>(_Destination_tuple) = _Node->
value();
12530 _Populate_destination_tuple<_Index + 1>(_Destination_tuple, _Sources);
12538 template<>
void _Populate_destination_tuple<std::tuple_size<_Type>::value>(_Destination_type &,
ISource<size_t> **)
12582 template<
typename _Type, join_type _Jtype = non_greedy>
12612 _Initialize_joins<0>();
12615 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
12642 _Initialize_joins<0>();
12671 _M_pJoinNode =
new _Join_node<_Type, _Destination_type, _Jtype>(_PScheduleGroup);
12672 _Initialize_joins<0>();
12706 _Join._M_pJoinNode =
NULL;
12723 _Delete_joins<0>();
12882 template<
int _Index>
12885 template<
int _Index>
12895 template<
int _Index>
12898 std::tuple_element_t<_Index, _Type> _Item = std::get<_Index>(
_M_sourceTuple);
12915 _Order_node_element =
new _Non_greedy_node_source_type(_Item,
_Index);
12932 _Order_node_element =
new _Greedy_node_source_type(_Item,
_Index);
12937 _Initialize_joins<_Index + 1>();
12945 template<>
void _Initialize_joins<std::tuple_size<_Type>::value>()
12956 template<
int _Index>
12961 _Delete_joins<_Index + 1>();
12969 template<>
void _Delete_joins<std::tuple_size<_Type>::value>()
12998 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
13030 template<
typename _Type1,
typename _Type2,
typename... _Types>
13032 make_join(Scheduler& _PScheduler, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
13069 template<
typename _Type1,
typename _Type2,
typename... _Types>
13070 multitype_join<std::tuple<_Type1, _Type2, _Types...>>
13071 make_join(ScheduleGroup& _PScheduleGroup, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
13073 return multitype_join<std::tuple<_Type1, _Type2, _Types...>>(_PScheduleGroup,
std::make_tuple(_Item1, _Item2, _Items...));
13105 template<
typename _Type1,
typename _Type2,
typename... _Types>
13106 multitype_join<std::tuple<_Type1, _Type2, _Types...>>
13113 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
13146 template<
typename _Type1,
typename _Type2,
typename... _Types>
13147 multitype_join<std::tuple<_Type1, _Type2, _Types...>,
greedy>
13148 make_greedy_join(Scheduler& _PScheduler, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
13150 return multitype_join<std::tuple<_Type1, _Type2, _Types...>,
greedy>(_PScheduler,
std::make_tuple(_Item1, _Item2, _Items...));
13185 template<
typename _Type1,
typename _Type2,
typename... _Types>
13186 multitype_join<std::tuple<_Type1, _Type2, _Types...>,
greedy>
13187 make_greedy_join(ScheduleGroup& _PScheduleGroup, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
13189 return multitype_join<std::tuple<_Type1, _Type2, _Types...>,
greedy>(_PScheduleGroup,
std::make_tuple(_Item1, _Item2, _Items...));
13221 template<
typename _Type1,
typename _Type2,
typename... _Types>
13222 multitype_join<std::tuple<_Type1, _Type2, _Types...>,
greedy>
13290 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
13471 virtual void run() = 0;
13520 agent(agent
const &);
13535 template <
class _Type>
13545 #pragma warning(pop)
virtual message< size_t > * accept_message(runtime_object_identity _MsgId)
Accept the message by making a copy of the payload.
Definition: agents.h:11326
void decline_incoming_messages()
Indicates to the block that new messages should be declined.
Definition: agents.h:5857
_Message * _Peek()
Definition: agents.h:227
call(_Call_method const &_Func, filter_method const &_Filter)
Constructs a call messaging block.
Definition: agents.h:7169
virtual void unlink_source(_Inout_ ISource< _Source_type > *_PSource)
Unlinks a specified source block from this target_block object.
Definition: agents.h:4660
_EType _M_value
Definition: agents.h:579
volatile bool _M_fIsInitialized
Definition: agents.h:9102
multitype_join const & operator=(multitype_join const &)
volatile long _M_lwtCount
A counter to indicate the number of outstanding LWTs
Definition: agents.h:2416
void _Propagate_priority_order(::Concurrency::details::_Queue< message< _Target_type >> &_MessageBuffer)
Propagate messages in priority order.
Definition: agents.h:9690
virtual size_t _Find(typename network_link_registry< _Block >::_EType _Link)
Searches the registry for the given link
Definition: agents.h:1186
void _Delete_choices()
Deletes all _Reserving_node elements that were created in _Initialize_choices.
Definition: agents.h:11819
This class describes an exception thrown when the link_target method of a messaging block is called a...
Definition: concrt.h:1570
virtual ~_AsyncOriginator()
Definition: agents.h:3981
single_assignment()
Constructs a single_assignment messaging block.
Definition: agents.h:8613
virtual bool supports_anonymous_source()
Overrides the supports_anonymous_source method to indicate that this block can accept messages offere...
Definition: agents.h:6201
void _Swap(_Myt &_Right)
Definition: agents.h:362
volatile long _M_referenceCount
Definition: agents.h:5549
_MessageProcessorType _M_messageProcessor
Processor used for asynchronous message handling
Definition: agents.h:5491
virtual message< _Target_type > * consume(runtime_object_identity _MsgId, _Inout_ ITarget< _Target_type > *_PTarget)
Consumes a message previously offered by this source_block object and successfully reserved by the ta...
Definition: agents.h:5108
void stop()
Stops the timer messaging block.
Definition: agents.h:8292
virtual void unlink_sources()
Unlinks all source blocks from this target_block object.
Definition: agents.h:4673
_Block * _EType
Definition: agents.h:1252
~single_assignment()
Destroys the single_assignment messaging block.
Definition: agents.h:8746
ISource< _Type > * _M_pReservedSource
Definition: agents.h:10556
~multitype_join()
Destroys the multitype_join messaging block.
Definition: agents.h:12720
virtual ~ISource()
Destroys the ISource object.
Definition: agents.h:2605
_Network_link_iterator(_MyContainer *_PNetwork_link, size_t _Index)
Construct iterator
Definition: agents.h:489
multitype_join(multitype_join &&_Join)
Constructs a multitype_join messaging block.
Definition: agents.h:12697
void _Invoke_handler(message< _Type > *_Msg)
Definition: agents.h:2350
_TargetLinkRegistry::iterator target_iterator
The iterator to walk the connected targets.
Definition: agents.h:4893
size_t _M_index
Definition: agents.h:422
_Reserving_node const & operator=(_Reserving_node const &)
virtual message_status propagate_message(_Inout_ message< _Source_type > *_PMessage, _Inout_ ISource< _Source_type > *_PSource)=0
When overridden in a derived class, this method asynchronously passes a message from an ISource block...
_Myt & operator++()
Pre-increment the iterator to point to the next element
Definition: agents.h:1354
virtual message< size_t > * consume(runtime_object_identity _MsgId, _Inout_ ITarget< size_t > *_PTarget)
Consumes a message previously offered by this choice messaging block and successfully reserved by the...
Definition: agents.h:11719
The multi_link_registry object is a network_link_registry that manages multiple source blocks or mult...
Definition: agents.h:909
void _To_array(::Concurrency::details::_Dynamic_array< _EType > &_Array)
Definition: agents.h:1709
_EType const * const_pointer
Definition: agents.h:1256
volatile long _M_referenceCount
Definition: agents.h:3969
propagator_block()
Constructs a propagator_block object.
Definition: agents.h:5606
unbounded_buffer()
Constructs an unbounded_buffer messaging block.
Definition: agents.h:5942
static _CONCRTIMP void __cdecl _Yield()
This class describes an exception thrown when an invalid operation is performed that is not more accu...
Definition: pplinterface.h:132
_Block * _EType
A type that represents a pointer to an element stored in the source_link_manager object.
Definition: agents.h:1445
void _Initialize(const _Type &_Value, _Inout_ ITarget< _Type > *_PTarget, bool _Repeating, _Inout_opt_ Scheduler *_PScheduler=NULL, _Inout_opt_ ScheduleGroup *_PScheduleGroup=NULL)
Common initialization.
Definition: agents.h:8512
virtual message< size_t > * accept(runtime_object_identity _MsgId, _Inout_ ITarget< size_t > *_PTarget)
Accepts a message that was offered by this choice block, transferring ownership to the caller...
Definition: agents.h:11672
_EType _M_sentinel
Definition: agents.h:1398
reference operator[](size_t _Pos)
Definition: agents.h:336
virtual message< _Type > * consume_message(runtime_object_identity _MsgId)
Consumes a message previously offered by the single_assignment and reserved by the target...
Definition: agents.h:8994
void _Initialize_order_node(ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget, Scheduler *_PScheduler=NULL, ScheduleGroup *_PScheduleGroup=NULL)
Validate constructor arguments and fully connect this _Order_node_base.
Definition: agents.h:10141
void _Propagate_message()
Definition: agents.h:5520
ScheduleGroup * _M_pScheduleGroup
Definition: agents.h:11848
_Non_greedy_node(Scheduler &_PScheduler, ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget, filter_method const &_Filter)
Constructs a _Non_greedy_node within the specified scheduler, and places it on any schedule group of ...
Definition: agents.h:11083
ISource< _Type > * _M_pReservedSource
Definition: agents.h:11378
_Message ** _M_ppTail
Definition: agents.h:113
constexpr tuple< typename _Unrefwrap< _Types >::type...> make_tuple(_Types &&..._Args)
Definition: tuple:890
_Reserving_node(Scheduler &_PScheduler, ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget=NULL)
Constructs a _Reserving_node within the specified scheduler, and places it on any schedule group of t...
Definition: agents.h:10273
virtual _EType _Get_element(size_t _Index) const =0
Retrieves the element at the given index. If the index is out of bounds, NULL is returned. Users need to use the iterator to access the links.
choice(choice &&_Choice)
Constructs a choice messaging block.
Definition: agents.h:11534
~_MessageArray()
Definition: agents.h:9920
_MessageArray _M_messageArray
Definition: agents.h:9927
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.
basic_ostream< _Elem, _Traits > & _Out(basic_ostream< _Elem, _Traits > &_Os, _Ty _Dx)
Definition: random:174
virtual bool reserve_message(runtime_object_identity _MsgId)
Reserves a message previously offered by this join messaging block.
Definition: agents.h:9502
virtual void _Reset()=0
Resets the _Order_node_base and prepares it for the next propagation
_Type _M_sourceTuple
Definition: agents.h:12543
Scheduler * _M_pScheduler
Definition: agents.h:11845
_Source_link_iterator< _LinkRegistry > _Myt
Definition: agents.h:1248
virtual void release_message(runtime_object_identity _MsgId)
Releases a previous message reservation.
Definition: agents.h:6947
multi_link_registry< ISource< _Type > > _SourceLinkRegistry
Definition: agents.h:5922
_Out_writes_opt_(_MaxCount)
void _Process_message(message< _Target_type > *_PMessage)
Definition: agents.h:5511
agent const & operator=(agent const &)
void _Consume_received_message()
Called for a non_greedy type join block in order to consume the message in this join block that has b...
Definition: agents.h:11231
const_pointer operator->() const
Returns a pointer to the class object
Definition: agents.h:1333
_CONCRTIMP agent_status status()
A synchronous source of status information from the agent.
virtual message_status send_message(_Inout_ message< _Type > *_PMessage, _Inout_ ISource< _Type > *_PSource)
Synchronously passes a message from an ISource block to this single_assignment messaging block...
Definition: agents.h:8871
bool _Is_head(runtime_object_identity _MsgId)
Definition: agents.h:233
bool _Non_greedy_acquire_messages()
Tries to acquire all of the messages from the _Non_greedy_nodes. Each node has already indicated that...
Definition: agents.h:12344
virtual message< _Target_type > * consume_message(runtime_object_identity _MsgId)=0
When overridden in a derived class, consumes a message that was previously reserved.
void _Wait_for_completion()
Definition: agents.h:3927
virtual bool reserve_message(runtime_object_identity _MsgId)
Reserves a message previously offered by this overwrite_buffer messaging block.
Definition: agents.h:6879
event _M_ev
Definition: agents.h:3958
::Concurrency::runtime_object_identity _M_id
Definition: agents.h:101
_Myt operator++(int)
Post-increment the iterator to point to the next element
Definition: agents.h:1367
static bool _send(ITarget< _Type > *_Trg, const _Type &_Data)
Definition: agents.h:4273
~_Non_greedy_node()
Cleans up any resources that may have been created by the _Order_node.
Definition: agents.h:11150
State _M_state
Definition: agents.h:8467
source_link_manager< _SourceLinkRegistry > _SourceLinkManager
The type of the source_link_manager this target_block object.
Definition: agents.h:4459
An event type that represents the linking of message blocks
Definition: concrt.h:5679
Non-greedy join messaging blocks postpone messages and try and consume them after all have arrived...
Definition: agents.h:9132
_Propagator_method _M_propagator
A message propagating object which exposes the callback to be invoked
Definition: agents.h:2434
virtual void propagate_to_any_targets(_Inout_opt_ message< size_t > *)
Takes the message and propagates it to all the targets of this _Order_node
Definition: agents.h:11355
join(size_t _NumInputs)
Constructs a join messaging block.
Definition: agents.h:9184
An event type that represents the unlinking of message blocks
Definition: concrt.h:5685
virtual void release(runtime_object_identity _MsgId, _Inout_ ITarget< _Destination_type > *_PTarget)
Releases a previous successful message reservation.
Definition: agents.h:12844
virtual void link_source(_Inout_ ISource< _Source_type > *_PSource)
Links a specified source block to this propagator_block object.
Definition: agents.h:5764
static _CONCRTIMP void __cdecl _ScheduleTask(TaskProc _Proc, void *_Data)
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...
virtual void sync_send(_Inout_opt_ message< _Target_type > *_Msg)
Synchronously queues up messages and starts a propagation task, if this has not been done already...
Definition: agents.h:5421
_SourceLinkRegistry::type::source_type _Source_type
The type of the payload for the incoming message to this propagator_block.
Definition: agents.h:5585
The basic message envelope containing the data payload being passed between messaging blocks...
Definition: agents.h:1776
Implements busy wait with no backoff
Definition: concrt.h:578
void release()
Releases the reference on the source_link_manager object.
Definition: agents.h:1628
_EType const * const_pointer
A type that provides a pointer to a const element in a network_link_registry object.
Definition: agents.h:624
const_reference operator*()
Returns the object pointed to by the iterator
Definition: agents.h:522
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
virtual message< _Type > * accept_message(runtime_object_identity _MsgId)
Accepts a message that was offered by this overwrite_buffer messaging block, returning a copy of the ...
Definition: agents.h:6839
size_t _M_maxLinks
Definition: agents.h:1225
multitype_join< std::tuple< _Type1, _Type2, _Types...>, greedy > make_greedy_join(_Type1 _Item1, _Type2 _Item2, _Types..._Items)
Constructs a greedy multitype_join messaging block from an optional Scheduler or ScheduleGroup and tw...
Definition: agents.h:13223
virtual void unlink_target(_Inout_ ITarget< size_t > *_PTarget)
Unlinks a target block from this choice messaging block.
Definition: agents.h:11641
void async_send(_Inout_opt_ message< _Source_type > *_PMessage)
Asynchronously sends a message for processing.
Definition: agents.h:4775
Definition: concrt.h:4128
runtime_object_identity _M_savedId
Definition: agents.h:10560
size_t _M_count
Definition: agents.h:116
_CONCRTIMP unsigned int _Release()
virtual ~target_block()
Destroys the target_block object.
Definition: agents.h:4484
void _Delete_joins()
Deletes all _Order_node elements that were created in _Initialize_joins.
Definition: agents.h:12957
virtual message< _Type > * accept_message(runtime_object_identity _MsgId)
Accepts a message that was offered by this single_assignment messaging block, returning a copy of the...
Definition: agents.h:8932
multi_link_registry< ISource< _Type > > _SourceLinkRegistry
Definition: agents.h:7121
~_Reserving_node()
Cleans up any resources that may have been created by the _Reserving_node.
Definition: agents.h:10368
Definition: agents.h:3687
void _Clear_queued_messages()
Definition: agents.h:2234
virtual void release_ref(_Inout_ ITarget< _Target_type > *_PTarget)
Releases a reference count on this source_block object.
Definition: agents.h:5208
multi_link_registry()
Constructs a multi_link_registry object.
Definition: agents.h:917
virtual void process_incoming_message()=0
When overridden in a derived class, performs the forward processing of messages into the block...
bool asend(_Inout_ ITarget< _Type > *_Trg, const _Type &_Data)
An asynchronous send operation, which schedules a task to propagate the data to the target block...
Definition: agents.h:4394
size_t count()
Counts the number of linked blocks in the source_link_manager object.
Definition: agents.h:1683
const_reference _Get(size_t _Pos) const
Definition: agents.h:1377
The ITarget class is the interface for all target blocks. Target blocks consume messages offered to t...
Definition: agents.h:453
void _Handle_message(message< _Target_type > *_PMessage)
Private methods.
Definition: agents.h:5501
::Concurrency::details::_Queue< message< _Destination_type > > _M_messageBuffer
Definition: agents.h:12551
The agent has been started, but not entered its run method.
Definition: agents.h:13249
virtual bool supports_anonymous_source()
Overrides the supports_anonymous_source method to indicate that this block can accept messages offere...
Definition: agents.h:6818
This class describes an exception thrown when a messaging block is given a pointer to a target which ...
Definition: concrt.h:1520
void(__cdecl * TaskProc)(void *)
Concurrency::details contains definitions of support routines in the public namespaces and one or mor...
Definition: concrt.h:251
_FS_DLL int __CLRCALL_PURE_OR_CDECL _Link(const wchar_t *, const wchar_t *)
virtual message_status propagate_message(_Inout_ message< _Type > *_PMessage, _Inout_ ISource< _Type > *_PSource)
Asynchronously passes a message from an ISource block to this single_assignment messaging block...
Definition: agents.h:8807
void decline_incoming_messages()
Indicates to the block that new messages should be declined.
Definition: agents.h:4720
virtual message< _Type > * consume_message(runtime_object_identity _MsgId)
Consumes a message previously offered by the timer and reserved by the target, transferring ownership...
Definition: agents.h:8394
_Type type
A type alias for _Type .
Definition: agents.h:1937
bool _internal_send(ITarget< _Type > *_PTarget, _Type const &_Value)
Definition: agents.h:3868
concurrent_queue< message< _Type > * > _M_queuedMessages
A queue of the messages
Definition: agents.h:2378
virtual network_link_registry< _Block >::iterator begin()
Returns an iterator to the first element in the multi_link_registry object.
Definition: agents.h:1042
virtual void unlink_target(ITarget< _Type > *)
Definition: agents.h:3548
An event type that represents the creation of an object
Definition: concrt.h:5649
virtual void resume_propagation()=0
When overridden in a derived class, resumes propagation after a reservation has been released...
_Type source_type
A type alias for _Type .
Definition: agents.h:2737
_LinkRegistry::type _Block
The type of the blocks being managed by the source_link_manager object.
Definition: agents.h:1433
__int64 _Trace_agents_get_id(_Type *_PObject)
Definition: agents.h:435
_Type type
A type alias for _Type .
Definition: agents.h:1902
virtual bool supports_anonymous_source()
When overridden in a derived class, returns true or false depending on whether the message block acce...
Definition: agents.h:2530
~join()
Destroys the join block.
Definition: agents.h:9338
virtual void link_target(_Inout_ ITarget< _Destination_type > *_PTarget)
Links a target block to this multitype_join messaging block.
Definition: agents.h:12743
void _Delete_stored_messages()
Deletes all messages currently stored in this message block. Should be called by the destructor to en...
Definition: agents.h:8547
_Join_node const & operator=(_Join_node const &)
std::function< void(void)> _Propagator_method
The signature of the callback method invoked while propagating messages.
Definition: agents.h:2022
_Greedy_node const & operator=(_Greedy_node const &)
static _CONCRTIMP agent_status __cdecl wait(_Inout_ agent *_PAgent, unsigned int _Timeout=COOPERATIVE_TIMEOUT_INFINITE)
Waits for an agent to complete its task.
bool _M_fForceRepropagation
A bool to signal to the processor to force a repropagation to occur
Definition: agents.h:6497
virtual void add(typename network_link_registry< _Block >::_EType _Link)
Adds a link to the single_link_registry object.
Definition: agents.h:775
Scheduler * _M_pScheduler
Definition: agents.h:13513
_TargetLinkRegistry _M_connectedTargets
Connected targets
Definition: agents.h:5485
~_Order_node_base()
Cleans up any resources that may have been created by the _Order_node.
Definition: agents.h:9999
void _Initialize_choices()
Constructs and initializes a _Reserving_node for each tuple messaging block passed in...
Definition: agents.h:11781
runtime_object_identity _M_savedId
Definition: agents.h:11384
The source_block class is an abstract base class for source-only blocks. The class provides basic lin...
Definition: agents.h:4879
volatile long _M_stopProcessing
A flag set in the destructor of a block to cease processing of new messages. This is required to guar...
Definition: agents.h:2410
virtual message< _Target_type > * accept(runtime_object_identity _MsgId, _Inout_ ITarget< _Target_type > *_PTarget)
Accepts a message that was offered by this source_block object, transferring ownership to the caller...
Definition: agents.h:5016
_TargetLinkRegistry::type::type _Target_type
The payload type of messages handled by this source_block.
Definition: agents.h:4887
_Dynamic_array()
Definition: agents.h:267
_Network_link_iterator< _Block > _Myt
Definition: agents.h:475
void _Done(message_status _Status)
Definition: agents.h:3945
virtual bool reserve(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:3791
single_link_registry< ITarget< _Type > > _Target_registry
Definition: agents.h:3534
_Myt & operator++()
Pre-increment the iterator to point to the next element
Definition: agents.h:548
single_assignment(filter_method const &_Filter)
Constructs a single_assignment messaging block.
Definition: agents.h:8635
_LinkRegistry _M_links
Definition: agents.h:1730
bool contains(_EType _Link)
Searches the network_link_registry within this source_link_manager object for a specified block...
Definition: agents.h:1670
void _Push_back(_Type const &_Element)
Definition: agents.h:319
message(_Type const &_P, runtime_object_identity _Id)
Constructs a message object.
Definition: agents.h:1810
_Type * _M_array
Definition: agents.h:419
virtual void release_message(runtime_object_identity _MsgId)=0
When overridden in a derived class, releases a previous message reservation.
The target did not accept the message.
Definition: agents.h:1751
message< _Type > * _M_pMessage
Definition: agents.h:7076
message(_Type const &_P)
Constructs a message object.
Definition: agents.h:1793
_Non_greedy_node(Scheduler &_PScheduler, ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget=NULL)
Constructs a _Non_greedy_node within the specified scheduler, and places it on any schedule group of ...
Definition: agents.h:11055
size_t _M_index
Definition: agents.h:1395
choice(_Type _Tuple)
Constructs a choice messaging block.
Definition: agents.h:11446
overwrite_buffer< agent_status > _M_status
Holds the current status of the agent.
Definition: agents.h:13492
virtual void link_target(ITarget< _Type > *)
Definition: agents.h:3673
virtual message< _Destination_type > * consume(runtime_object_identity _MsgId, _Inout_ ITarget< _Destination_type > *_PTarget)
Consumes a message previously offered by the multitype_join messaging block and successfully reserved...
Definition: agents.h:12829
virtual void unlink_source(_Inout_ ISource< _Source_type > *_PSource)
Unlinks a specified source block from this propagator_block object.
Definition: agents.h:5779
The target postponed the message.
Definition: agents.h:1756
_CONCRTIMP _Runtime_object()
The Concurrency namespace provides classes and functions that provide access to the Concurrency Runti...
Definition: agents.h:43
virtual message< _OutputType > * accept_message(runtime_object_identity _MsgId)
Accepts a message that was offered by this join messaging block, transferring ownership to the caller...
Definition: agents.h:9472
virtual void release(runtime_object_identity _MsgId, _Inout_ ITarget< size_t > *_PTarget)
Releases a previous successful message reservation.
Definition: agents.h:11734
void _Reset()
Resets the _Greedy_node and prepares it for the next propagation
Definition: agents.h:10769
_EType const & const_reference
A type that provides a reference to a const element stored in a network_link_registry object for read...
Definition: agents.h:617
bool _Reserve_received_message()
Called for a non_greedy type join block in order to reserve the message in this join block ...
Definition: agents.h:11189
Helper class used in multi-type greedy join blocks Ordered node is a single-target, single-source ordered propagator block
Definition: agents.h:10584
virtual void link_target(_Inout_ ITarget< _Type > *_PTarget)=0
When overridden in a derived class, links a target block to this ISource block.
_FunctorType _Call_method
The function type that this block executes upon receiving a message.
Definition: agents.h:7119
virtual ~source_block()
Destroys the source_block object.
Definition: agents.h:4913
_CRT_BEGIN_C_HEADER _Check_return_ _Ret_maybenull_ _In_ size_t _Size
Definition: corecrt_malloc.h:58
::Concurrency::details::_ReentrantPPLLock _M_resetLock
Definition: agents.h:10953
virtual bool supports_anonymous_source()
Overrides the supports_anonymous_source method to indicate that this block can accept messages offere...
Definition: agents.h:7413
_SourceLinkManager::iterator source_iterator
The type of the iterator for the source_link_manager for this target_block object.
Definition: agents.h:4465
single_link_registry()
Constructs a single_link_registry object.
Definition: agents.h:742
volatile long _M_counter
Definition: agents.h:12548
Helper class used in multi-type choice blocks Ordered node is a single-target, single-source ordered ...
Definition: agents.h:10196
join_type
The type of a join messaging block.
Definition: agents.h:9120
virtual void release(runtime_object_identity _MsgId, _Inout_ ITarget< _Type > *_PTarget)=0
When overridden in a derived class, releases a previous successful message reservation.
Scheduler * _M_pScheduler
Definition: agents.h:12983
virtual void release_ref(_Inout_ ITarget< size_t > *_PTarget)
Releases a reference count on this choice messaging block.
Definition: agents.h:11766
_Type _M_sourceTuple
Definition: agents.h:11842
void propagate_to_any_targets(_Inout_opt_ message< _OutputType > *)
Constructs an output message containing an input message from each source when they have all propagat...
Definition: agents.h:9582
Definition: agents.h:11981
virtual void link_source(_Inout_ ISource< _Source_type > *_PSource)
Links a specified source block to this target_block object.
Definition: agents.h:4642
The timer has been initialized, but not yet started.
Definition: agents.h:8129
virtual void acquire_ref(_Inout_ ITarget< _Destination_type > *_PTarget)
Acquires a reference count on this multitype_join messaging block, to prevent deletion.
Definition: agents.h:12860
An ordered_message_processor is a message_processor that allows message blocks to process messages in...
Definition: agents.h:2009
_LockType _M_lock
Definition: agents.h:1721
_Reserving_node(ScheduleGroup &_PScheduleGroup, ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget, filter_method const &_Filter)
Constructs a _Order_node within the specified schedule group. The scheduler is implied by the schedul...
Definition: agents.h:10355
_Payload_type const & value()
Gets the message whose index was selected by the choice messaging block.
Definition: agents.h:11613
multitype_join< std::tuple< _Type1, _Type2, _Types...> > make_join(_Type1 _Item1, _Type2 _Item2, _Types..._Items)
Constructs a non_greedy multitype_join messaging block from an optional Scheduler or ScheduleGroup an...
Definition: agents.h:13107
virtual ~single_link_registry()
Destroys the single_link_registry object.
Definition: agents.h:754
const_pointer operator->() const
Returns a pointer to the class object
Definition: agents.h:535
void enable_batched_processing()
Enables batched processing for this block.
Definition: agents.h:4757
_Type _M_sourceTuple
Definition: agents.h:12980
virtual void unlink_source(_Inout_ ISource< _Type > *_PSource)=0
When overridden in a derived class, unlinks a specified source block from this ITarget block...
__int32 runtime_object_identity
Each message instance has an identity that follows it as it is cloned and passed between messaging co...
Definition: agents.h:51
Helper class used in multi-type non-greedy join blocks Ordered node is a single-target, single-source ordered propagator block
Definition: agents.h:10978
_In_ size_t _In_ int _Index
Definition: time.h:102
void _Invoke_link_source(ITarget< _Type > *_PLinkFrom)
Links this source to a target.
Definition: agents.h:2754
multi_link_registry< ISource< _Type > > _SourceLinkRegistry
Definition: agents.h:10200
void pause()
Stops the timer messaging block. If it is a repeating timer messaging block, it can be restarted with...
Definition: agents.h:8305
virtual void process_input_messages(_Inout_ message< _Source_type > *)
Processes messages that are received as inputs.
Definition: agents.h:4826
size_t _Size() const
Definition: agents.h:354
virtual void release(runtime_object_identity _MsgId, _Inout_ ITarget< _Target_type > *_PTarget)
Releases a previous successful message reservation.
Definition: agents.h:5157
virtual message< _Type > * accept(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:3561
~_Join_node()
Cleans up any resources that may have been created by the join.
Definition: agents.h:12059
_Greedy_node(Scheduler &_PScheduler, ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget, filter_method const &_Filter)
Constructs a _Greedy_node within the specified scheduler, and places it on any schedule group of the ...
Definition: agents.h:10686
An event type that represents the name for an object
Definition: concrt.h:5691
message< _Type > * _M_pReceiveMessage
Definition: agents.h:10169
virtual void release_ref(_Inout_ ITarget< _Type > *)
When overridden in a derived class, releases a reference count on this ISource block.
Definition: agents.h:3609
volatile bool _M_fIsInitialized
Definition: agents.h:11390
A timer messaging block is a single-target source_block capable of sending a message to its target af...
Definition: agents.h:8111
virtual void _Next_index(size_t &_Index)
Skips empty slots and updates the index to the next non-empty slot. This is called by the iterator...
Definition: agents.h:1057
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...
virtual message_status send_message(_Inout_ message< _Type > *_PMessage, _Inout_ ISource< _Type > *_PSource)
Synchronously passes a message from an ISource block to this unbounded_buffer messaging block...
Definition: agents.h:6177
_CONCRTIMP void __cdecl _Trace_agents(Agents_EventType _Type, __int64 _AgentId,...)
size_t _M_size
Definition: agents.h:425
The agent finished without being canceled.
Definition: agents.h:13259
_Reserving_node(ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget, filter_method const &_Filter)
Constructs a _Reserving_node within the default scheduler, and places it on any schedule group of the...
Definition: agents.h:10247
void _Wait_on_ref()
Definition: agents.h:3935
size_t index()
Returns an index into the tuple representing the element selected by the choice messaging block...
Definition: agents.h:11592
_Type & reference
Definition: agents.h:261
size_t _Count() const
Definition: agents.h:132
message< std::vector< _Type > > *__cdecl _Create_new_message()
Constructs a new message from the data output.
Definition: agents.h:9745
bool send(ITarget< _Type > &_Trg, const _Type &_Data)
A synchronous send operation, which waits until the target either accepts or declines the message...
Definition: agents.h:4366
bool has_value() const
Checks whether this single_assignment messaging block has been initialized with a value yet...
Definition: agents.h:8762
The single_link_registry object is a network_link_registry that manages only a single source or targe...
Definition: agents.h:734
virtual message< _OutputType > * consume_message(runtime_object_identity _MsgId)
Consumes a message previously offered by the join messaging block and reserved by the target...
Definition: agents.h:9522
choice< std::tuple< _Type1, _Type2, _Types...> > make_choice(_Type1 _Item1, _Type2 _Item2, _Types..._Items)
Constructs a choice messaging block from an optional Scheduler or ScheduleGroup and two or more input...
Definition: agents.h:11969
multi_link_registry< ISource< _Type > > _SourceLinkRegistry
Definition: agents.h:10982
The timer has started and been paused.
Definition: agents.h:8139
A multitype_join messaging block is a multi-source, single-target messaging block that combines toget...
Definition: agents.h:12583
void _Delete_stored_messages()
Deletes all messages currently stored in this message block. Should be called by the destructor to en...
Definition: agents.h:9079
runtime_object_identity * _M_savedIds
Definition: agents.h:9938
virtual bool reserve_message(runtime_object_identity _MsgId)
Reserves a message previously offered by this single_assignment messaging block.
Definition: agents.h:8965
void _Populate_destination_tuple(_Destination_type &_Destination_tuple, ISource< size_t > **_Sources)
Copies payloads from all sources to destination tuple.
Definition: agents.h:12522
virtual bool contains(typename network_link_registry< _Block >::_EType _Link)
Searches the single_link_registry object for a specified block.
Definition: agents.h:822
choice const & operator=(choice const &)
An unbounded_buffer messaging block is a multi-target, multi-source, ordered propagator_block capable...
Definition: agents.h:5918
void _Clear()
Definition: agents.h:307
bool _SpinOnce()
Spins for one time quantum,until a maximum spin is reached.
Definition: concrt.h:626
The message_processor class is the abstract base class for processing of message objects. There is no guarantee on the ordering of the messages.
Definition: agents.h:1930
bool _Release_received_message()
Called for a non_greedy type join block release a reservation on this block
Definition: agents.h:11253
overwrite_buffer const & operator=(overwrite_buffer const &)
unbounded_buffer(filter_method const &_Filter)
Constructs an unbounded_buffer messaging block.
Definition: agents.h:5965
multitype_join(_Type _Tuple)
Constructs a multitype_join messaging block.
Definition: agents.h:12609
_Queue()
Definition: agents.h:122
size_t _M_count
Definition: agents.h:9937
_Block * _EType
Definition: agents.h:479
_Source_link_iterator< _LinkRegistry > iterator
A type that provides an iterator that can read or modify any element in the source_link_manager objec...
Definition: agents.h:1468
timer const & operator=(timer const &)
#define _InterlockedDecrementSizeT(_Target)
Definition: concrt.h:97
virtual ~ordered_message_processor()
Destroys the ordered_message_processor object.
Definition: agents.h:2057
static const size_t _NOT_SET
Definition: agents.h:1222
std::tuple< typename std::remove_pointer_t< _Types >::source_type...> type
Definition: agents.h:11993
overwrite_buffer(filter_method const &_Filter)
Constructs an overwrite_buffer messaging block.
Definition: agents.h:6572
bool _internal_asend(ITarget< _Type > *_PTarget, _Type const &_Value)
Definition: agents.h:3643
virtual void resume_propagation()
Resumes propagation after a reservation has been released
Definition: agents.h:12201
virtual void link_target_notification(_Inout_ ITarget< std::vector< _Type >> *)
A callback that notifies that a new target has been linked to this join messaging block...
Definition: agents.h:9564
message< _Type > * _M_pMessage
Definition: agents.h:3679
virtual message< _Type > * accept(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:3757
virtual message< _Type > * accept(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:4053
The timer has been started.
Definition: agents.h:8134
_Target_registry _M_connectedTargets
Definition: agents.h:4262
message< _Type > const & operator=(message< _Type > const &)
virtual void propagate_to_any_targets(_Inout_ message< _Type > *_PMessage)
Places the message _PMessage in this overwrite_buffer messaging block and offers it to all of the li...
Definition: agents.h:7002
static void __cdecl _Agent_task_wrapper(void *data)
volatile bool _M_fDeclineMessages
A bool that is set to indicate that all messages should be declined in preparation for deleting the b...
Definition: agents.h:5897
virtual bool reserve_message(runtime_object_identity _MsgId)
Reserves a message previously offered by the source.
Definition: agents.h:12155
virtual bool contains(_EType _Link)=0
When overridden in a derived class, searches the network_link_registry object for a specified block...
int i[4]
Definition: dvec.h:68
_Join_node(Scheduler &_PScheduler)
Constructs a join within the specified scheduler, and places it on any schedule group of the schedule...
Definition: agents.h:12037
::Concurrency::details::_NonReentrantPPLLock _M_asyncSendLock
A lock to use for queueing incoming messages.
Definition: agents.h:2384
single_link_registry< ITarget< size_t > > _TargetLinkRegistry
Definition: agents.h:10199
ScheduleGroup * _M_pScheduleGroup
Definition: agents.h:13514
virtual void link_source(_Inout_ ISource< _Type > *_PSource)=0
When overridden in a derived class, links a specified source block to this ITarget block...
virtual bool reserve(runtime_object_identity, ITarget< _Type > *)
Definition: agents.h:3585
virtual message_status send_message(_Inout_ message< _Type > *_PMessage, _Inout_ ISource< _Type > *_PSource)
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.
Definition: agents.h:7381
_Type dequeue()
Removes an item from the unbounded_buffer messaging block.
Definition: agents.h:6112
virtual void resume_propagation()
Resumes propagation after a reservation has been released.
Definition: agents.h:6968
virtual void process_input_messages(_Inout_ message< _Target_type > *)
Process input messages. This is only useful for propagator blocks, which derive from source_block ...
Definition: agents.h:5809
virtual ~multi_link_registry()
Destroys the multi_link_registry object.
Definition: agents.h:929
virtual void sync_send(_Inout_opt_ message< _Type > *_Msg)=0
When overridden in a derived class, places messages into the block synchronously. ...
virtual message_status propagate(_Inout_opt_ message< _Source_type > *_PMessage, _Inout_opt_ ISource< _Source_type > *_PSource)
Asynchronously passes a message from a source block to this target block.
Definition: agents.h:5641
virtual void propagate_to_any_targets(_Inout_opt_ message< _Destination_type > *)
Takes the message and propagates it to all the targets of this join block.
Definition: agents.h:12233
volatile bool _M_fIsInitialized
Definition: agents.h:10563
_Type const & const_reference
Definition: agents.h:262
A class intended to be used as a base class for all independent agents. It is used to hide state from...
Definition: agents.h:13275
_LockType::_Scoped_lock _LockHolder
A type that provides a RAII scoped lock holder for a lock.
Definition: agents.h:1480
An event type that represents the conclusion of some processing
Definition: concrt.h:5661
_MessageArray(size_t _NumInputs)
Definition: agents.h:9913
virtual void add(_EType _Link)=0
When overridden in a derived class, adds a link to the network_link_registry object.
#define _In_z_
Definition: sal.h:310
message_status
The valid responses for an offer of a message object to a block.
Definition: agents.h:1740
virtual void link_target_notification(_Inout_ ITarget< _Type > *_PTarget)
A callback that notifies that a new target has been linked to this timer messaging block...
Definition: agents.h:8434
bool send(_Inout_ ITarget< _Type > *_Trg, const _Type &_Data)
A synchronous send operation, which waits until the target either accepts or declines the message...
Definition: agents.h:4337
#define _In_
Definition: sal.h:305
virtual ~_Source_link_iterator()
Destruct iterator
Definition: agents.h:1272
runtime_object_identity msg_id() const
Returns the ID of the message object.
Definition: agents.h:1861
virtual void _Reset()
Resets the _Reserving_node and prepares it for the next propagation
Definition: agents.h:10388
_In_ wctype_t _Type
Definition: corecrt_wctype.h:111
volatile long _M_refCount
Definition: agents.h:1913
void _Invoke_unlink_source(ITarget< _Type > *_PUnlinkFrom)
Unlinks this source from a target.
Definition: agents.h:2773
_Call_method _M_pFunc
Definition: agents.h:7450
virtual void link_target(_Inout_ ITarget< size_t > *_PTarget)
Links a target block to this choice messaging block.
Definition: agents.h:11629
#define _Inout_opt_
Definition: sal.h:376
virtual message< _Target_type > * accept_message(runtime_object_identity _MsgId)=0
When overridden in a derived class, accepts an offered message by the source. Message blocks should o...
_Message * _Dequeue()
Definition: agents.h:204
message< _Type > * _M_pMessage
Definition: agents.h:9096
This class describes an exception thrown when an operation has timed out.
Definition: concrt.h:1712
Definition: concrt.h:4089
message(_In_ message const *_Msg)
Constructs a message object.
Definition: agents.h:1840
_SourceLinkRegistry::type::source_type _Source_type
The type of the payload for the incoming messages to this target_block object.
Definition: agents.h:4453
_Join_node(ScheduleGroup &_PScheduleGroup)
Constructs a join within the specified schedule group. The scheduler is implied by the schedule group...
Definition: agents.h:12050
const_reference operator[](size_t _Pos) const
Index operation. Retrieve an element at the specified index.
Definition: agents.h:1342
virtual message_status propagate_message(message< _Type > *_PMessage, ISource< _Type > *_PSource)
Asynchronously passes a message from an ISource block to this ITarget block. It is invoked by the pro...
Definition: agents.h:10418
single_link_registry< ITarget< size_t > > _TargetLinkRegistry
Definition: agents.h:10587
::Concurrency::details::_Queue< message< std::vector< _Type > > > _M_messageBuffer
Definition: agents.h:9961
runtime_object_identity _M_reservedId
Definition: agents.h:11387
single_link_registry< ITarget< size_t > > _TargetLinkRegistry
Definition: agents.h:10981
virtual void propagate_to_any_targets(_Inout_opt_ message< _Type > *_PMessage)
Places the message _PMessage in this single_assignment messaging block and offers it to all of the l...
Definition: agents.h:9052
virtual void unlink_targets()
When overridden in a derived class, unlinks all target blocks from this ISource block.
Definition: agents.h:4018
Definition: agents.h:4267
overwrite_buffer()
Constructs an overwrite_buffer messaging block.
Definition: agents.h:6550
_CONCRTIMP bool start()
Moves an agent from the agent_created state to the agent_runnable state, and schedules it for executi...
An overwrite_buffer messaging block is a multi-target, multi-source, ordered propagator_block capable...
Definition: agents.h:6527
Definition: agents.h:9908
multi_link_registry< ISource< _Type > > _SourceLinkRegistry
Definition: agents.h:6531
The target_block class is an abstract base class that provides basic link management functionality an...
Definition: agents.h:4446
void start()
Starts the timer messaging block. The specified number of milliseconds after this is called...
Definition: agents.h:8279
virtual void link_target_notification(_Inout_ ITarget< _Target_type > *)
A callback that notifies that a new target has been linked to this source_block object.
Definition: agents.h:5241
virtual void acquire_ref(_Inout_ ITarget< _Type > *)
When overridden in a derived class, acquires a reference count on this ISource block, to prevent deletion.
Definition: agents.h:4158
bool remove(_EType _Link)
Removes a link from the source_link_manager object.
Definition: agents.h:1569
virtual void resume_propagation()
Resumes propagation after a reservation has been released.
Definition: agents.h:9022
virtual void acquire_ref(_Inout_ ITarget< _Type > *)
When overridden in a derived class, acquires a reference count on this ISource block, to prevent deletion.
Definition: agents.h:3604
::Concurrency::details::_Dynamic_array< _EType > _M_array
Definition: agents.h:1389
virtual message< _Type > * consume(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:3813
virtual void unlink_target(_Inout_ ITarget< _Destination_type > *_PTarget)
Unlinks a target block from this multitype_join messaging block.
Definition: agents.h:12755
virtual void resume_propagation()
Resumes propagation after a reservation has been released.
Definition: agents.h:6293
virtual size_t count()=0
When overridden in a derived class, returns the number of items in the network_link_registry object...
_Unwrap< _Type >::type _Destination_type
Definition: agents.h:12587
virtual void link_target_notification(_Inout_ ITarget< _Destination_type > *)
Notification that a target was linked to this source.
Definition: agents.h:12217
~choice()
Destroys the choice messaging block.
Definition: agents.h:11557
_Type value()
Gets a reference to the current payload of the message being stored in the overwrite_buffer messaging...
Definition: agents.h:6717
bool _M_fRepeating
Definition: agents.h:8473
_Block * _EType
A type that represents an element pointer stored in the network_link_registry object.
Definition: agents.h:610
bool _M_fDeclineMessages
A bool that is set to indicate that all messages should be declined in preparation for deleting the b...
Definition: agents.h:4848
virtual bool reserve_message(runtime_object_identity _MsgId)=0
When overridden in a derived class, reserves a message previously offered by this source_block object...
_EType const * const_pointer
A type that provides a pointer to a const element in a source_link_manager object.
Definition: agents.h:1458
volatile long _M_queuedDataCount
A count of the current number of messages to process. Used as a flag to see if a new process message ...
Definition: agents.h:2391
::Concurrency::details::_ReentrantPPLLock _M_internalLock
Definition: agents.h:3964
virtual void _Fire()
Called when the timer fires.
Definition: agents.h:8494
network_link_registry< _Block >::_EType _M_connectedLink
Definition: agents.h:896
virtual message< _Type > * consume(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:4104
void wait_for_async_sends()
Waits for all asynchronous propagations to complete.
Definition: agents.h:4800
virtual size_t count()
Counts the number of items in the multi_link_registry object.
Definition: agents.h:1027
::Concurrency::details::_ReentrantPPLLock::_Scoped_lock _R_lock
A lock holder that acquires a reentrant lock on instantiation and releases it on destruction ...
Definition: agents.h:65
static _CONCRTIMP void __cdecl wait_for_all(size_t _Count, _In_reads_(_Count) agent **_PAgents, _Out_writes_opt_(_Count) agent_status *_PStatus=NULL, unsigned int _Timeout=COOPERATIVE_TIMEOUT_INFINITE)
Waits for all of the specified agents to complete their tasks.
_SavedMessageIdArray(size_t _NumInputs)
Definition: agents.h:9940
volatile long _M_iteratorCount
Definition: agents.h:1724
std::vector< _Type > _OutputType
Definition: agents.h:9166
_Type type
A type alias for _Type .
Definition: agents.h:2539
This class describes an exception thrown when a messaging block is unable to find a requested message...
Definition: concrt.h:1544
virtual void _Next_index(size_t &_Index)=0
Skips empty slots and updates the index to the next non-empty slot. This is called by the iterator...
virtual void acquire_ref(_Inout_ ITarget< size_t > *_PTarget)
Acquires a reference count on this choice messaging block, to prevent deletion.
Definition: agents.h:11750
virtual void unlink_targets()
Unlinks all targets from this choice messaging block.
Definition: agents.h:11654
long remove_ref()
Subtracts from the reference count for the message object. Used for message blocks that need referenc...
Definition: agents.h:1893
Definition: concrt.h:5341
multi_link_registry< ISource< size_t > > _SourceLinkRegistry
Definition: agents.h:12012
~call()
Destroys the call messaging block.
Definition: agents.h:7312
virtual void unlink_target_notification(_Inout_ ITarget< _Target_type > *_PTarget)
A callback that notifies that a target has been unlinked from this source_block object.
Definition: agents.h:5257
_Type type
A type alias for _Type .
Definition: agents.h:12730
void remove_sources()
Unlinks all sources after waiting for outstanding asynchronous send operations to complete...
Definition: agents.h:4815
_Type const payload
The payload of the message object.
Definition: agents.h:1870
The target tried to accept the message, but it was no longer available.
Definition: agents.h:1761
void _Initialize_joins()
Constructs and initializes a _Order_node for each tuple messaging block passed in.
Definition: agents.h:12896
source_link_manager()
Constructs a source_link_manager object.
Definition: agents.h:1486
multi_link_registry< ISource< _Type > > _SourceLinkRegistry
Definition: agents.h:10588
::Concurrency::details::_ReentrantPPLLock _M_internalLock
Definition: agents.h:4259
message< _Type > ** _M_messages
Definition: agents.h:9911
The target accepted the message.
Definition: agents.h:1746
_CRT_BEGIN_C_HEADER typedef void(__CRTDECL *terminate_handler)()
message< _Type > * _M_pMessage
Definition: agents.h:3955
_In_ size_t _Out_opt_ int _In_z_ unsigned char const * _Src
Definition: mbstring.h:1039
::Concurrency::details::_ReentrantPPLLock _LockType
A type that provides a reentrant lock for the source_link_manager object.
Definition: agents.h:1474
single_link_registry< ITarget< _Destination_type > > _TargetLinkRegistry
Definition: agents.h:12011
multi_link_registry< ITarget< _Type > > _TargetLinkRegistry
Definition: agents.h:5921
virtual _CONCRTIMP ~agent()
Destroys the agent.
void enable_batched_processing()
Enables batched processing for this block.
Definition: agents.h:5397
_SyncOriginator()
Definition: agents.h:3694
volatile long _M_fCancelable
Definition: agents.h:13507
_CONCRTIMP ISource< agent_status > * status_port()
An asynchronous source of status information from the agent.
_EType const & const_reference
Definition: agents.h:1255
An event type that represents the scheduling of a process
Definition: concrt.h:5673
_Type const & value()
Gets a reference to the current payload of the message being stored.
Definition: agents.h:10026
::Concurrency::details::_ReentrantPPLLock _M_internalLock
Internal lock used for the following synchronization:
Definition: agents.h:5547
::Concurrency::details::_NonReentrantPPLLock::_Scoped_lock _NR_lock
A lock holder that acquires a non-reentrant lock on instantiation and releases it on destruction...
Definition: agents.h:58
_Myt const & operator=(_Myt const &_Right)
Copy assign an iterator
Definition: agents.h:1296
_Source_link_iterator(_MyContainer *_PNetwork_link, size_t _Index)
Construct iterator
Definition: agents.h:1262
volatile long _M_refcount
Definition: agents.h:4256
ScheduleGroup * _M_pScheduleGroup
Definition: agents.h:12986
virtual void acquire_ref(_Inout_ ITarget< _Target_type > *)
Acquires a reference count on this source_block object, to prevent deletion.
Definition: agents.h:5192
A join messaging block is a single-target, multi-source, ordered propagator_block which combines toge...
Definition: agents.h:9154
void _Sync_send_helper(message< _Type > *_Msg)
Definition: agents.h:2243
virtual ~_SyncOriginator()
Definition: agents.h:3702
virtual void link_target(ITarget< _Type > *_PTarget)
Definition: agents.h:3911
The network_link_registry abstract base class manages the links between source and target blocks...
Definition: agents.h:460
message< _Type > * _M_pReservedMessage
Definition: agents.h:7079
void _Delete_stored_messages()
Deletes all messages currently stored in this message block. Should be called by the destructor to en...
Definition: agents.h:12503
virtual void add(typename network_link_registry< _Block >::_EType _Link)
Adds a link to the multi_link_registry object.
Definition: agents.h:970
The ISource class is the interface for all source blocks. Source blocks propagate messages to ITarget...
Definition: agents.h:452
_MessageProcessorType _M_messageProcessor
The message_processor for this target_block.
Definition: agents.h:4854
virtual void resume_propagation()
Resumes propagation after a reservation has been released.
Definition: agents.h:8421
_Type type
A type alias for _Type .
Definition: agents.h:2028
_SourceLinkManager _M_connectedSources
The container for all the sources connected to this block.
Definition: agents.h:5884
bool has_value() const
Checks whether this choice messaging block has been initialized with a value yet. ...
Definition: agents.h:11576
void add(_EType _Link)
Adds a source link to the source_link_manager object.
Definition: agents.h:1531
single_link_registry< ITarget< _Type > > _Target_registry
Definition: agents.h:3691
virtual message_status propagate_message(_Inout_ message< _Type > *_PMessage, _Inout_ ISource< _Type > *_PSource)
Asynchronously passes a message from an ISource block to this unbounded_buffer messaging block...
Definition: agents.h:6139
Definition: agents.h:9935
virtual message< _Type > * consume(runtime_object_identity, ITarget< _Type > *)
Definition: agents.h:3591
virtual message< size_t > * consume_message(runtime_object_identity)
Consumes a message previously offered by the source and reserved by the target, transferring ownershi...
Definition: agents.h:10079
virtual void propagate_to_any_targets(_Inout_opt_ message< size_t > *)
Takes the message and propagates it to all the targets of this _Order_node
Definition: agents.h:10502
void initialize_target(_Inout_opt_ Scheduler *_PScheduler=NULL, _Inout_opt_ ScheduleGroup *_PScheduleGroup=NULL)
Initializes the base object. Specifically, the message_processor object needs to be initialized...
Definition: agents.h:4738
#define false
Definition: stdbool.h:16
_Greedy_node(ScheduleGroup &_PScheduleGroup, ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget=NULL)
Constructs a _Greedy_node within the specified schedule group. The scheduler is implied by the schedu...
Definition: agents.h:10711
_Non_greedy_node const & operator=(_Non_greedy_node const &)
virtual void unlink_sources()
Unlinks all source blocks from this propagator_block object.
Definition: agents.h:5792
bool enqueue(_Type const &_Item)
Adds an item to the unbounded_buffer messaging block.
Definition: agents.h:6100
virtual void unlink_targets()
Unlinks all target blocks from this source_block object.
Definition: agents.h:4978
void * _InterlockedCompareExchangePointer(void *volatile *, void *, void *)
const unsigned int COOPERATIVE_TIMEOUT_INFINITE
Value indicating that a wait should never time out.
Definition: concrt.h:3478
virtual bool reserve_message(runtime_object_identity _MsgId)
Reserves a message previously offered by this unbounded_buffer messaging block.
Definition: agents.h:6247
virtual message< _Destination_type > * accept_message(runtime_object_identity _MsgId)
Accepts an offered message by the source, transferring ownership to the caller.
Definition: agents.h:12125
ScheduleGroup * _M_pScheduleGroup
The schedule group to process messages on
Definition: agents.h:2403
virtual void link_target(_Inout_ ITarget< _Target_type > *_PTarget)
Links a target block to this source_block object.
Definition: agents.h:4932
virtual bool remove(typename network_link_registry< _Block >::_EType _Link)
Removes a link from the single_link_registry object.
Definition: agents.h:801
bool _M_fReferencedScheduler
Definition: agents.h:8476
_Greedy_node(Scheduler &_PScheduler, ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget=NULL)
Constructs a _Greedy_node within the specified scheduler, and places it on any schedule group of the ...
Definition: agents.h:10659
virtual void acquire_ref(_Inout_ ITarget< _Type > *)
When overridden in a derived class, acquires a reference count on this ISource block, to prevent deletion.
Definition: agents.h:3853
_CONCRTIMP _Timer(unsigned int _Ms, bool _FRepeating)
message_status _Propagate_to_target(ITarget< size_t > *_PTarget)
Propagate messages to the given target
Definition: agents.h:10522
long _Process_message_helper()
Definition: agents.h:2273
void initialize_source(_Inout_opt_ Scheduler *_PScheduler=NULL, _Inout_opt_ ScheduleGroup *_PScheduleGroup=NULL)
Initializes the message_propagator within this source_block.
Definition: agents.h:5383
void set_bound(size_t _MaxLinks)
Sets the maximum number of source links that can be added to this source_link_manager object...
Definition: agents.h:1519
_CONCRTIMP bool cancel()
Moves an agent from either the agent_created or agent_runnable states to the agent_canceled state...
Definition: agents.h:3974
bool has_value() const
Checks whether this block has been initialized yet.
Definition: agents.h:10014
_Type const & value()
Gets a reference to the current payload of the message being stored in the single_assignment messagin...
Definition: agents.h:8778
An event type that represents the initiation of some processing
Definition: concrt.h:5655
_In_reads_(_N) wchar_t const *_S2
An event type that represents the deletion of an object
Definition: concrt.h:5667
message< size_t > * _M_pSendMessage
Definition: agents.h:10172
void Trace_agents_register_name(_Inout_ _Type *_PObject, _In_z_ const wchar_t *_Name)
Associates the given name to the message block or agent in the ETW trace.
Definition: agents.h:13536
virtual void link_target_notification(_Inout_ ITarget< _Type > *_PTarget)
A callback that notifies that a new target has been linked to this unbounded_buffer messaging block...
Definition: agents.h:6316
~unbounded_buffer()
Destroys the unbounded_buffer messaging block.
Definition: agents.h:6081
virtual void async_send(_Inout_opt_ message< _Type > *_Msg)
Asynchronously queues up messages and starts a processing task, if this has not been done already...
Definition: agents.h:2127
_CONCRTIMP agent()
Constructs an agent.
virtual void release_ref(_Inout_ ITarget< _Type > *)
When overridden in a derived class, releases a reference count on this ISource block.
Definition: agents.h:3858
virtual network_link_registry< _Block >::iterator begin()
Returns an iterator to the first element in the single_link_registry object.
Definition: agents.h:849
::Concurrency::details::_NonReentrantPPLLock _M_propagationLock
Definition: agents.h:10950
agent_status
The valid states for an agent.
Definition: agents.h:13239
multi_link_registry< ITarget< _Type > > _TargetLinkRegistry
Definition: agents.h:6530
bool _internal_send(ITarget< _Type > *_PTarget, _Type const &_Value)
Definition: agents.h:4181
_Join_node< _Type, _Destination_type, _Jtype > * _M_pJoinNode
Definition: agents.h:12977
unbounded_buffer const & operator=(unbounded_buffer const &)
virtual void unlink_targets()
Unlinks all targets from this multitype_join messaging block.
Definition: agents.h:12764
_Non_greedy_node(ScheduleGroup &_PScheduleGroup, ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget, filter_method const &_Filter)
Constructs a _Non_greedy_node within the specified schedule group. The scheduler is implied by the sc...
Definition: agents.h:11137
source_link_manager< _LinkRegistry > _MyContainer
Definition: agents.h:1249
volatile size_t _M_messagesRemaining
Definition: agents.h:9904
_Type _M_value
Definition: agents.h:8470
~_Dynamic_array()
Definition: agents.h:275
_Non_greedy_node(ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget, filter_method const &_Filter)
Constructs a _Non_greedy_node within the default scheduler, and places it on any schedule group of th...
Definition: agents.h:11029
bool _Remove(_Message *_OldElement)
Definition: agents.h:156
void _Propagate_priority_order(::Concurrency::details::_Queue< message< _Target_type >> &_MessageBuffer)
Propagates messages in priority order.
Definition: agents.h:6409
virtual void link_target_notification(_Inout_ ITarget< size_t > *)
Notification that a target was linked to this source.
Definition: agents.h:10120
virtual void _Next_index(size_t &_Index)
Skips empty slots and updates the index to the next non-empty slot. This is called by the iterator...
Definition: agents.h:864
void _Acquire_ref()
Definition: agents.h:4236
typename std::remove_pointer_t< std::tuple_element_t< _Index, _Type >>::source_type _Source_type
Definition: agents.h:12883
_CONCRTIMP bool done()
Moves an agent into the agent_done state, indicating that the agent has completed.
void _Create_send_message()
Create a message that contains an index used to determine the source message
Definition: agents.h:10132
virtual void initialize_batched_processing(_Handler_method const &_Processor, _Propagator_method const &_Propagator)
Initialize batched message processing
Definition: agents.h:2095
virtual ::Concurrency::runtime_object_identity _GetId() const
Definition: agents.h:94
virtual message_status propagate_message(message< _Type > *_PMessage, ISource< _Type > *_PSource)
Asynchronously passes a message from an ISource block to this ITarget block. It is invoked by the pro...
Definition: agents.h:10848
_Target_registry _M_connectedTargets
Definition: agents.h:3967
message * _M_pNext
Definition: agents.h:1907
void register_filter(filter_method const &_Filter)
Registers a filter method that will be invoked on every message received.
Definition: agents.h:4705
constexpr auto data(_Container &_Cont) -> decltype(_Cont.data())
Definition: xutility:1512
A single_assignment messaging block is a multi-target, multi-source, ordered propagator_block capable...
Definition: agents.h:8589
virtual void unlink_target(ITarget< _Type > *_PTarget)
Definition: agents.h:3712
_CONCRTIMP size_t wait(unsigned int _Timeout=COOPERATIVE_TIMEOUT_INFINITE)
Waits for the event to become signaled.
memcpy(_Destination, _Source, _SourceSize)
virtual bool contains(typename network_link_registry< _Block >::_EType _Link)
Searches the multi_link_registry object for a specified block.
Definition: agents.h:1010
bool _internal_send(ITarget< _Type > *_PTarget, _Type const &_Value)
Definition: agents.h:3618
_Handler_method _M_handler
A message handler object which exposes the callback to be invoked
Definition: agents.h:2422
network_link_registry< _Block > _MyContainer
Definition: agents.h:476
_SourceLinkManager _M_connectedSources
The container for all the sources connected to this block.
Definition: agents.h:4835
virtual void release(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:4136
State
Tracks the state machine of the timer.
Definition: agents.h:8123
size_t _Count() const
Returns the count of items in the registry.
Definition: agents.h:1207
Base class for Helper node used in multi-type join and choice blocks Order node is a single-target...
Definition: agents.h:9980
_Non_greedy_node(ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget=NULL)
Constructs a _Non_greedy_node within the default scheduler, and places it on any schedule group of th...
Definition: agents.h:11004
void wait_for_outstanding_async_sends()
Waits for all asynchronous propagations to complete. This propagator-specific spin wait is used in de...
Definition: agents.h:5446
size_t _M_index
Definition: agents.h:10175
virtual network_link_registry< _Block >::_EType _Get_element(size_t _Index) const
Retrieves the element at the given index. If the index is out of bounds, NULL is returned. Users need to use the iterator to access the links
Definition: agents.h:1082
bool _Remove(typename network_link_registry< _Block >::_EType _Link)
Removes a link from the multi_link_registry
Definition: agents.h:1151
void _Invoke_handler(long _Count)
Definition: agents.h:2320
_In_ _Value
Definition: corecrt_wstdlib.h:65
size_t _M_index
Definition: agents.h:576
_Type type
A type alias for _Type .
Definition: agents.h:11567
virtual message< _Destination_type > * accept(runtime_object_identity _MsgId, _Inout_ ITarget< _Destination_type > *_PTarget)
Accepts a message that was offered by this multitype_join block, transferring ownership to the caller...
Definition: agents.h:12782
_EType const & const_reference
A type that provides a reference to a const element stored in a source_link_manager object for readin...
Definition: agents.h:1452
void _Add(typename network_link_registry< _Block >::_EType _Link)
Adds a link to the multi_link_registry object.
Definition: agents.h:1101
virtual void unlink_targets()=0
When overridden in a derived class, unlinks all target blocks from this ISource block.
Scheduler * _M_pScheduler
Definition: agents.h:8479
virtual void unlink_targets()
When overridden in a derived class, unlinks all target blocks from this ISource block.
Definition: agents.h:3733
_EType const * const_pointer
Definition: agents.h:483
_SourceLinkManager::iterator source_iterator
The type of the iterator for the source_link_manager for this propagator_block.
Definition: agents.h:5597
~source_link_manager()
Destroys the source_link_manager object.
Definition: agents.h:1494
runtime_object_identity * _M_savedIdBuffer
Definition: agents.h:9955
runtime_object_identity _M_reservedId
Reserved message ID
Definition: agents.h:5479
_Type receive(_Inout_ ISource< _Type > *_Src, unsigned int _Timeout=COOPERATIVE_TIMEOUT_INFINITE)
A general receive implementation, allowing a context to wait for data from exactly one source and fil...
Definition: agents.h:3063
virtual message< _Type > * consume_message(runtime_object_identity _MsgId)
Consumes a message previously offered by the unbounded_buffer messaging block and reserved by the tar...
Definition: agents.h:6267
_Pre_maybenull_ _Inout_ _Deref_prepost_z_ wchar_t const _PSource
Definition: wchar.h:148
ITarget< _Type > * _M_pTarget
Definition: agents.h:3682
std::function< void(message< _Type > *)> _Handler_method
The signature of the callback method invoked while processing messages.
Definition: agents.h:2016
size_t _M_count
Definition: agents.h:9910
message< _Destination_type > * _Create_send_message()
Called when all the source messaging blocks have received their messages. The payloads are copied int...
Definition: agents.h:12451
virtual void release(runtime_object_identity, ITarget< _Type > *)
Definition: agents.h:3599
virtual message_status propagate_message(_Inout_ message< _Type > *_PMessage, _Inout_ ISource< _Type > *_PSource)
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.
Definition: agents.h:7338
_Myt operator++(int)
Post-increment the iterator to point to the next element
Definition: agents.h:563
message< _Type > * _NewMessage() const
Allocates a new message.
Definition: agents.h:8485
virtual void release_message(runtime_object_identity _MsgId)
Releases a previous message reservation.
Definition: agents.h:9535
_CONCRTIMP void set()
Signals the event.
virtual void link_target(ITarget< _Type > *_PTarget)
Definition: agents.h:4218
void _Initialize(size_t _NumInputs, Scheduler *_PScheduler=NULL, ScheduleGroup *_PScheduleGroup=NULL)
Initializes the join messaging block.
Definition: agents.h:9858
void initialize(_Inout_opt_ Scheduler *_PScheduler, _Inout_opt_ ScheduleGroup *_PScheduleGroup, _Handler_method const &_Handler)
Initializes the ordered_message_processor object with the appropriate callback function, scheduler and schedule group.
Definition: agents.h:2078
virtual void release_ref(_Inout_ ITarget< _Type > *)
When overridden in a derived class, releases a reference count on this ISource block.
Definition: agents.h:4163
virtual void propagate_to_any_targets(_Inout_opt_ message< _Type > *)
Tries to offer the message produced by the timer block to all of the linked targets.
Definition: agents.h:8448
_Reserving_node(ScheduleGroup &_PScheduleGroup, ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget=NULL)
Constructs a _Order_node within the specified schedule group. The scheduler is implied by the schedul...
Definition: agents.h:10327
volatile message_status _M_fStatus
Definition: agents.h:3961
virtual void release(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:3831
void initialize_source_and_target(_Inout_opt_ Scheduler *_PScheduler=NULL, _Inout_opt_ ScheduleGroup *_PScheduleGroup=NULL)
Initializes the base object. Specifically, the message_processor object needs to be initialized...
Definition: agents.h:5827
long __cdecl _InterlockedDecrement(long volatile *)
A choice messaging block is a multi-source, single-target block that represents a control-flow intera...
Definition: agents.h:11422
virtual message_status propagate_message(message< _Type > *_PMessage, ISource< _Type > *)
Asynchronously passes a message from an ISource block to this ITarget block. It is invoked by the pro...
Definition: agents.h:11302
virtual message< _Type > * accept_message(runtime_object_identity _MsgId)
Accepts a message that was offered by this timer messaging block, transferring ownership to the calle...
Definition: agents.h:8339
void _Wait_on_ref(long _RefCount=0)
Definition: agents.h:5529
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 targe...
void _Delete_stored_messages()
Deletes all messages currently stored in this message block. Should be called by the destructor to en...
Definition: agents.h:9884
filter_method * _M_pFilter
The filter function which determines whether offered messages should be accepted. ...
Definition: agents.h:5890
~overwrite_buffer()
Destroys the overwrite_buffer messaging block.
Definition: agents.h:6685
_LinkRegistry type
The type of link registry being managed by the source_link_manager object.
Definition: agents.h:1427
virtual void process_input_messages(_Inout_ message< _Type > *_PMessage)
Executes the call function on the input messages.
Definition: agents.h:7435
~_SavedMessageIdArray()
Definition: agents.h:9947
static bool _asend(ITarget< _Type > *_Trg, const _Type &_Data)
Definition: agents.h:4294
virtual bool reserve(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:4082
#define _CONCRTIMP
Definition: crtdefs.h:48
virtual void propagate_to_any_targets(_Inout_opt_ message< size_t > *)
Takes the message and propagates it to all the targets of this _Greedy_node
Definition: agents.h:10922
virtual void release_message(runtime_object_identity)
Releases a previous message reservation.
Definition: agents.h:10094
_MyContainer * _M_pNetwork_link
Definition: agents.h:1392
single_assignment const & operator=(single_assignment const &)
void * _M_pSourceJoins[std::tuple_size< _Type >::value]
Definition: agents.h:12974
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 offer...
Definition: agents.h:2546
virtual void unlink_targets()
When overridden in a derived class, unlinks all target blocks from this ISource block.
Definition: agents.h:3554
_AsyncOriginator()
Definition: agents.h:4174
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.
virtual network_link_registry< _Block >::_EType _Get_element(size_t _Index) const
Retrieves the element at the given index. If the index is out of bounds, NULL is returned. Users need to use the iterator to access the links.
Definition: agents.h:883
virtual message< size_t > * accept_message(runtime_object_identity _MsgId)
Accept the message by making a copy of the payload.
Definition: agents.h:10892
void _Release_ref()
Definition: agents.h:4243
ITarget< typename _Block::source_type > *volatile _M_pLinkedTarget
Definition: agents.h:1733
_Diff _Count
Definition: algorithm:1941
_Greedy_node(ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget, filter_method const &_Filter)
Constructs a _Greedy_node within the default scheduler, and places it on any schedule group of the sc...
Definition: agents.h:10634
_Myt & operator=(const _Myt &_Right)
Definition: agents.h:283
single_link_registry< ITarget< std::vector< _Type > > > _TargetLinkRegistry
Definition: agents.h:9157
call(_Call_method const &_Func)
Constructs a call messaging block.
Definition: agents.h:7144
#define _Inout_
Definition: sal.h:375
virtual bool reserve(runtime_object_identity _MsgId, _Inout_ ITarget< size_t > *_PTarget)
Reserves a message previously offered by this choice messaging block.
Definition: agents.h:11696
virtual bool reserve_message(runtime_object_identity)
Reserves a message previously offered by the source.
Definition: agents.h:10057
_Type _Receive_impl(ISource< _Type > *_Src, unsigned int _Timeout, typename ITarget< _Type >::filter_method const *_Filter_proc)
A general receive implementation, allowing a context to wait for data from exactly one source and fil...
Definition: agents.h:2808
void register_filter(filter_method const &_Filter)
Registers a filter method that will be invoked on every received message.
Definition: agents.h:5842
void _Propagate_priority_order(::Concurrency::details::_Queue< message< _Target_type >> &_MessageBuffer)
Propagate messages in priority order
Definition: agents.h:12398
virtual message_status send(_Inout_ message< _Source_type > *_PMessage, _Inout_ ISource< _Source_type > *_PSource)
Synchronously initiates a message to this block. Called by an ISource block. When this function compl...
Definition: agents.h:5689
~_Queue()
Definition: agents.h:127
_CONCRTIMP unsigned int _Reference()
virtual void link_target_notification(_Inout_ ITarget< _Type > *_PTarget)
A callback that notifies that a new target has been linked to this single_assignment messaging block...
Definition: agents.h:9035
virtual void propagate_output_messages()
Places the message _PMessage in this unbounded_buffer messaging block and tries to offer it to all o...
Definition: agents.h:6369
volatile bool _M_fIsInitialized
Definition: agents.h:7082
_EType const & const_reference
Definition: agents.h:482
virtual message_status propagate_message(message< size_t > *_PMessage, ISource< size_t > *_PSource)
Asynchronously passes a message from an ISource block to this ITarget block. It is invoked by the pro...
Definition: agents.h:12085
virtual void process_incoming_message()
The processing function that is called asynchronously. It dequeues messages and begins processing the...
Definition: agents.h:2218
virtual message_status propagate_message(_Inout_ message< _Type > *_PMessage, _Inout_ ISource< _Type > *_PSource)
Asynchronously passes a message from an ISource block to this overwrite_buffer messaging block...
Definition: agents.h:6743
_Non_greedy_node(ScheduleGroup &_PScheduleGroup, ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget=NULL)
Constructs a _Non_greedy_node within the specified schedule group. The scheduler is implied by the sc...
Definition: agents.h:11109
Definition: agents.h:3530
void _Delete_stored_messages()
Deletes all messages currently stored in this message block. Should be called by the destructor to en...
Definition: agents.h:7044
runtime_object_identity _M_savedId
Definition: agents.h:10957
_Message * _M_pHead
Definition: agents.h:110
Defines a block allowing sources of distinct types to be joined. Join node is a single-target, multi-source ordered propagator block
Definition: agents.h:12008
virtual void link_target_notification(_Inout_ ITarget< _Type > *_PTarget)
A callback that notifies that a new target has been linked to this overwrite_buffer messaging block...
Definition: agents.h:6981
_Greedy_node(ScheduleGroup &_PScheduleGroup, ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget, filter_method const &_Filter)
Constructs a _Greedy_node within the specified schedule group. The scheduler is implied by the schedu...
Definition: agents.h:10738
const_reference operator[](size_t _Pos) const
Definition: agents.h:345
~_Greedy_node()
Cleans up any resources that may have been created by the _Greedy_node.
Definition: agents.h:10750
Definition: concrt.h:4144
source_link_manager< _SourceLinkRegistry > _SourceLinkManager
The type of the source_link_manager this propagator_block.
Definition: agents.h:5591
void _Init()
Definition: agents.h:385
void remove_network_links()
Removes all the source and target network links from this propagator_block object.
Definition: agents.h:5866
void _Delete_stored_messages()
Deletes all messages currently stored in this message block. Should be called by the destructor to en...
Definition: agents.h:6462
void register_target_block(_Inout_ ITarget< typename _Block::source_type > *_PTarget)
Registers the target block that holds this source_link_manager object.
Definition: agents.h:1506
single_assignment< size_t > * _M_pSingleAssignment
Definition: agents.h:11839
_Message type
Definition: agents.h:119
void _Reset()
Resets the _Order_node and prepares it for the next propagation
Definition: agents.h:11170
_Join_node()
Constructs a join within the default scheduler, and places it on any schedule group of the scheduler'...
Definition: agents.h:12024
_SavedMessageIdArray _M_savedMessageIdArray
Definition: agents.h:9952
Const Iterator for referenced link manager.
Definition: agents.h:1242
virtual message< _Type > * accept_message(runtime_object_identity _MsgId)
Accepts a message that was offered by this unbounded_buffer messaging block, transferring ownership t...
Definition: agents.h:6217
virtual message_status send_message(_Inout_ message< _Source_type > *, _Inout_ ISource< _Source_type > *)
When overridden in a derived class, this method synchronously passes a message from an ISource block ...
Definition: agents.h:4624
_LinkRegistry::type _Block
Definition: agents.h:1246
iterator begin()
Returns an iterator to the first element in the source_link_manager object.
Definition: agents.h:1700
A call messaging block is a multi-source, ordered target_block that invokes a specified function when...
Definition: agents.h:7112
ITarget< _Target_type > * _M_pReservedFor
Connected target that is holding a reservation
Definition: agents.h:5473
~timer()
Destroys a timer messaging block.
Definition: agents.h:8249
_MyContainer * _M_pNetwork_link
Definition: agents.h:573
virtual ~propagator_block()
Destroys a propagator_block object.
Definition: agents.h:5614
long __cdecl _InterlockedIncrement(long volatile *)
join(size_t _NumInputs, filter_method const &_Filter)
Constructs a join messaging block.
Definition: agents.h:9210
bool asend(ITarget< _Type > &_Trg, const _Type &_Data)
An asynchronous send operation, which schedules a task to propagate the value to the target block...
Definition: agents.h:4423
virtual void propagate_to_any_targets(_Inout_opt_ message< _Target_type > *_PMessage)
When overridden in a derived class, propagates the given message to any or all of the linked targets...
Definition: agents.h:5362
_Network_link_iterator< _Block > iterator
A type that provides an iterator that can read or modify any element in a network_link_registry objec...
Definition: agents.h:636
virtual ~message()
Destroys the message object.
Definition: agents.h:1852
call const & operator=(call const &)
virtual void resume_propagation()
Resumes propagation after a reservation has been released.
Definition: agents.h:9548
virtual message_status send_message(_Inout_ message< _Type > *_PMessage, _Inout_ ISource< _Type > *_PSource)
Synchronously passes a message from an ISource block to this overwrite_buffer messaging block...
Definition: agents.h:6787
::Concurrency::details::_Dynamic_array< _EType > _M_pendingRemove
Definition: agents.h:1727
virtual message_status send_message(_Inout_ message< _Source_type > *, _Inout_ ISource< _Source_type > *)
When overridden in a derived class, this method synchronously passes a message from an ISource block ...
Definition: agents.h:5751
const_reference operator*()
Returns the object pointed to by the iterator
Definition: agents.h:1321
source_block()
Constructs a source_block object.
Definition: agents.h:4899
const size_t COOPERATIVE_WAIT_TIMEOUT
Value indicating that a wait timed out.
Definition: concrt.h:3469
single_link_registry< ITarget< _Type > > _TargetLinkRegistry
Definition: agents.h:8114
_Dynamic_array< _Type > _Myt
Definition: agents.h:259
_CONCRTIMP::Concurrency::Scheduler * _GetScheduler()
Definition: concrt.h:382
message< _Type > * _M_pMessage
Definition: agents.h:4253
long add_ref()
Adds to the reference count for the message object. Used for message blocks that need reference count...
Definition: agents.h:1880
virtual void unlink_sources()=0
When overridden in a derived class, unlinks all source blocks from this ITarget block.
virtual void release_message(runtime_object_identity _MsgId)
Releases a previous message reservation.
Definition: agents.h:6280
virtual void wait()=0
When overridden in a derived class, waits for all asynchronous operations to complete.
#define SIZE_MAX
Definition: limits.h:76
_Order_node_base()
Constructs a _Order_node_base within the default scheduler, and places it on any schedule group of th...
Definition: agents.h:9988
_Network_link_iterator(_Myt const &_Right)
Copy construct an iterator
Definition: agents.h:498
::Concurrency::details::_ReentrantPPLLock _M_resetLock
Definition: agents.h:11381
virtual bool reserve(runtime_object_identity _MsgId, _Inout_ ITarget< _Target_type > *_PTarget)
Reserves a message previously offered by this source_block object.
Definition: agents.h:5052
bool _Try_receive_impl(ISource< _Type > *_Src, _Type &_value, typename ITarget< _Type >::filter_method const *_Filter_proc)
Helper function that implements try_receive A general try-receive implementation, allowing a context ...
Definition: agents.h:3199
_Handler_method _M_processor
A message processing object which exposes the callback to be invoked
Definition: agents.h:2428
_Result
Definition: corecrt_wconio.h:362
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 s...
void set_bound(size_t _MaxLinks)
Sets an upper bound on the number of links that the multi_link_registry object can hold...
Definition: agents.h:952
virtual bool reserve(runtime_object_identity _MsgId, _Inout_ ITarget< _Destination_type > *_PTarget)
Reserves a message previously offered by this multitype_join messaging block.
Definition: agents.h:12806
::Concurrency::details::_Queue< message< _Type > > _M_messageBuffer
Message queue used to store messages
Definition: agents.h:6491
virtual message_status send(_Inout_ message< _Source_type > *_PMessage, _Inout_ ISource< _Source_type > *_PSource)
Synchronously passes a message from a source block to this target block.
Definition: agents.h:4562
void reference()
Acquires a reference on the source_link_manager object.
Definition: agents.h:1618
void sync_send(_Inout_opt_ message< _Source_type > *_PMessage)
Synchronously send a message for processing.
Definition: agents.h:4787
virtual void process_input_messages(_Inout_ message< _Target_type > *)
Process input messages. This is only useful for propagator blocks, which derive from source_block ...
Definition: agents.h:5340
_Block type
A type that represents the block type stored in the network_link_registry object. ...
Definition: agents.h:604
bool has_value() const
Checks whether this overwrite_buffer messaging block has a value yet.
Definition: agents.h:6701
ordered_message_processor()
Constructs an ordered_message_processor object.
Definition: agents.h:2038
virtual void release_ref(_Inout_ ITarget< _Type > *_PTarget)=0
When overridden in a derived class, releases a reference count on this ISource block.
virtual ~ITarget()
Destroys the ITarget object.
Definition: agents.h:2468
virtual message< _Destination_type > * consume_message(runtime_object_identity _MsgId)
Consumes a message previously offered by the source and reserved by the target, transferring ownershi...
Definition: agents.h:12175
virtual void process_message(message< _Source_type > *)
When overridden in a derived class, processes a message that was accepted by this target_block object...
Definition: agents.h:4689
static void __cdecl _Process_incoming_message_wrapper(void *_Data)
Wrapper for process_incoming_message suitable for use as a argument to CreateThread and other similar...
Definition: agents.h:1993
_Source_link_iterator(_Myt const &_Right)
Copy construct an iterator
Definition: agents.h:1283
The source_link_manager object manages messaging block network links to ISource blocks.
Definition: agents.h:1232
virtual void process_input_messages(_Inout_ message< _Type > *_PMessage)
Places the message _PMessage in this unbounded_buffer messaging block and tries to offer it to all o...
Definition: agents.h:6347
::Concurrency::details::_NonReentrantPPLLock _M_propagationLock
Definition: agents.h:9958
long __cdecl _InterlockedCompareExchange(long volatile *, long, long)
single_link_registry< ITarget< _Type > > _Target_registry
Definition: agents.h:3978
virtual bool reserve_message(runtime_object_identity _MsgId)
Reserves a message previously offered by this timer messaging block.
Definition: agents.h:8366
multi_link_registry< ISource< _Type > > _SourceLinkRegistry
Definition: agents.h:9158
static const int _S_growthFactor
Definition: agents.h:427
virtual ~_AnonymousOriginator()
Definition: agents.h:3542
virtual void release_message(runtime_object_identity _MsgId)
Releases a previous message reservation.
Definition: agents.h:12188
::Concurrency::details::_NonReentrantPPLLock _M_propagationLock
Definition: agents.h:9099
virtual void sync_send(_Inout_opt_ message< _Type > *_Msg)
Synchronously queues up messages and starts a processing task, if this has not been done already...
Definition: agents.h:2109
message< _Type > * _M_pMessage
Definition: agents.h:8464
virtual iterator begin()=0
When overridden in a derived class, returns an iterator to the first element in the network_link_regi...
void * _M_pSourceChoices[std::tuple_size< _Type >::value]
Definition: agents.h:11836
virtual void resume_propagation()
Resumes propagation after a reservation has been released
Definition: agents.h:10107
virtual void async_send(_Inout_opt_ message< _Type > *_Msg)=0
When overridden in a derived class, places messages into the block asynchronously.
virtual message< _Type > * consume_message(runtime_object_identity _MsgId)
Consumes a message previously offered by the overwrite_buffer messaging block and reserved by the tar...
Definition: agents.h:6914
filter_method * _M_pFilter
The filter function which determines whether offered messages should be accepted. ...
Definition: agents.h:4841
virtual message_status propagate(_Inout_opt_ message< _Source_type > *_PMessage, _Inout_opt_ ISource< _Source_type > *_PSource)
Asynchronously passes a message from a source block to this target block.
Definition: agents.h:4511
::Concurrency::details::_Queue< message< _Type > > _M_processedMessages
Message queue used to store processed messages
Definition: agents.h:6485
The concurrent_queue class is a sequence container class that allows first-in, first-out access to it...
Definition: concurrent_queue.h:55
virtual void unlink_target(ITarget< _Type > *_PTarget)
Definition: agents.h:3989
message(message const &_Msg)
Constructs a message object.
Definition: agents.h:1827
void _Grow(size_t _NewSize)
Definition: agents.h:395
std::function< void(_Block *, bool)> _Callback_method
The method signature for a callback method for this source_link_manager object.
Definition: agents.h:1439
multi_link_registry< ISource< _Type > > _SourceLinkRegistry
Definition: agents.h:8593
_Myt const & operator=(_Myt const &_Right)
Copy assign an iterator
Definition: agents.h:508
The propagator_block class is an abstract base class for message blocks that are both a source and ta...
Definition: agents.h:5578
_Reserving_node(Scheduler &_PScheduler, ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget, filter_method const &_Filter)
Constructs a _Reserving_node within the specified scheduler, and places it on any schedule group of t...
Definition: agents.h:10301
Greedy join messaging blocks immediately accept a message upon propagation. This is more efficient...
Definition: agents.h:9126
bool try_receive(_Inout_ ISource< _Type > *_Src, _Type &_value)
A general try-receive implementation, allowing a context to look for data from exactly one source and...
Definition: agents.h:3421
virtual void process_message(_Inout_ message< _Type > *_PMessage)
Processes a message that was accepted by this call messaging block.
Definition: agents.h:7425
constexpr const _Ty &() _Right
Definition: algorithm:3723
virtual void release_message(runtime_object_identity _MsgId)
Releases a previous message reservation.
Definition: agents.h:9008
virtual void async_send(_Inout_opt_ message< _Target_type > *_Msg)
Asynchronously queues up messages and starts a propagation task, if this has not been done already ...
Definition: agents.h:5435
The agent has been created but not started.
Definition: agents.h:13244
virtual void propagate_output_messages()
Propagate messages to targets.
Definition: agents.h:5349
void remove_targets()
Removes all target links for this source block. This should be called from the destructor.
Definition: agents.h:5455
multi_link_registry< ITarget< _Type > > _TargetLinkRegistry
Definition: agents.h:8592
bool _Try_consume_source_messages(_Destination_type &_Destination_tuple, ISource< size_t > **_Sources)
Tries to reserve from all sources. If successful, it will consume all the messages ...
Definition: agents.h:12287
virtual void release_ref(_Inout_ ITarget< _Destination_type > *_PTarget)
Releases a reference count on this multiple_join messaging block.
Definition: agents.h:12876
_Greedy_node(ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget=NULL)
Constructs a _Greedy_node within the default scheduler, and places it on any schedule group of the sc...
Definition: agents.h:10610
_Reserving_node(ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget=NULL)
Constructs a _Reserving_node within the default scheduler, and places it on any schedule group of the...
Definition: agents.h:10222
#define NULL
Definition: corecrt.h:158
The agent has started.
Definition: agents.h:13254
virtual size_t count()
Counts the number of items in the single_link_registry object.
Definition: agents.h:834
message< _Type > * _M_pGreedyMessage
Definition: agents.h:10947
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.
The agent was canceled.
Definition: agents.h:13264
Scheduler * _M_pScheduler
The scheduler to process messages on
Definition: agents.h:2397
virtual void wait()
A processor-specific spin wait used in destructors of message blocks to make sure that all asynchrono...
Definition: agents.h:2189
Const iterator for network link registry. Message blocks should use the link_registry::iterator type ...
Definition: agents.h:471
_AnonymousOriginator()
Definition: agents.h:3537
bool _Enqueue(_Message *_Element)
Definition: agents.h:140
timer(unsigned int _Ms, _Type const &_Value, ITarget< _Type > *_PTarget=NULL, bool _Repeating=false)
Constructs a timer messaging block that will fire a given message after a specified interval...
Definition: agents.h:8172
target_block()
Constructs a target_block object.
Definition: agents.h:4473
virtual message< size_t > * accept_message(runtime_object_identity _MsgId)
Accept the message by making a copy of the payload.
Definition: agents.h:10459
virtual void release_message(runtime_object_identity _MsgId)
Releases a previous message reservation.
Definition: agents.h:8406
The timer has been stopped.
Definition: agents.h:8144
#define _InterlockedIncrementSizeT(_Target)
Definition: concrt.h:96
_In_ size_t _Deref_pre_opt_z_ char const ** _PSrc
Definition: wchar.h:78
volatile long _M_fStartable
Definition: agents.h:13500
_Order_node_base const & operator=(_Order_node_base const &)
::Concurrency::details::_Dynamic_array< typename network_link_registry< _Block >::_EType > _M_vector
Definition: agents.h:1228
static _CONCRTIMP _Scheduler __cdecl _Get()
static _CONCRTIMP void __cdecl wait_for_one(size_t _Count, _In_reads_(_Count) agent **_PAgents, agent_status &_Status, size_t &_Index, unsigned int _Timeout=COOPERATIVE_TIMEOUT_INFINITE)
Waits for any one of the specified agents to complete its task.
virtual void run()=0
Represents the main task of an agent. run should be overridden in a derived class, and specifies what the agent should do after it has been started.
virtual void unlink_target(_Inout_ ITarget< _Target_type > *_PTarget)
Unlinks a target block from this source_block object.
Definition: agents.h:4957
virtual message_status propagate_message(_Inout_ message< _Source_type > *_PMessage, _Inout_ ISource< _Source_type > *_PSource)=0
When overridden in a derived class, this method asynchronously passes a message from an ISource block...
message_status propagate_message(_Inout_ message< _Type > *_PMessage, _Inout_ ISource< _Type > *_PSource)
Asynchronously passes a message from an ISource block to this join messaging block. It is invoked by the propagate method, when called by a source block.
Definition: agents.h:9369