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>
119 typedef typename _Message
type;
145 *_M_ppTail = _Element;
146 _Element->_M_pNext =
NULL;
147 _M_ppTail = &(_Element->_M_pNext);
158 bool _Result =
false;
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++)
399 _Type * _Array =
new _Type[_NewSize];
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;
1115 for (
size_t _Index = 0; _Index <
_Size; _Index++)
1121 _Insert_pos = _Index + 1;
1131 if (_Insert_pos < _Size)
1155 for (
size_t _Index = 0; _Index <
_M_vector._Size(); _Index++)
1189 for (_Index = 0; _Index <
_M_vector._Size(); _Index++)
1211 for (
size_t _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>>;
1810 message(_Type
const &_P, runtime_object_identity _Id)
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)
2824 filter_method
const& _Filter,
2826 _M_pFilter(
NULL), _M_pConnectedTo(
NULL), _M_pMessage(
NULL), _M_fState(_NotInitialized), _M_timeout(_Timeout)
2828 if (_Filter !=
NULL)
2830 _M_pFilter =
new filter_method(_Filter);
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;
3019 filter_method * _M_pFilter;
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)
3214 filter_method
const& _Filter) :
3215 _M_pFilter(
NULL), _M_pConnectedTo(
NULL), _M_pMessage(
NULL), _M_isInitialized(0)
3217 if (_Filter !=
NULL)
3219 _M_pFilter =
new filter_method(_Filter);
3226 ~_Immediate_recipient()
3235 bool _Value(_Type & _value)
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;
3381 filter_method * _M_pFilter;
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.");
5364 throw invalid_operation(
"To use ordered message processing, you must override propagate_to_any_targets in the message block.");
5575 template<
class _TargetLinkRegistry,
class _SourceLinkRegistry,
5646 if (_PMessage ==
NULL)
5648 throw std::invalid_argument(
"_PMessage");
5651 if (_PSource ==
NULL)
5653 throw std::invalid_argument(
"_PSource");
5690 if (_PMessage ==
NULL)
5692 throw std::invalid_argument(
"_PMessage");
5695 if (_PSource ==
NULL)
5697 throw std::invalid_argument(
"_PSource");
5810 throw invalid_operation(
"To use batched processing, you must override process_input_messages in the message block.");
5843 if (_Filter !=
NULL)
5916 template<
class _Type>
5972 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
6101 return ::Concurrency::send<_Type>(
this, _Item);
6113 return ::Concurrency::receive<_Type>(
this);
6147 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
6149 if (_PMessage !=
NULL)
6178 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
6180 if (_PMessage !=
NULL)
6348 if (_PMessage !=
NULL)
6380 if(_PInputMessage ==
NULL)
6418 while (_Msg !=
NULL)
6426 _Status = _PTarget->
propagate(_Msg,
this);
6452 _Msg = _MessageBuffer._Peek();
6525 template<
class _Type>
6578 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
6718 return ::Concurrency::receive<_Type>(
this);
6750 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
6756 if (_PMessage !=
NULL)
6759 _PMessage->add_ref();
6788 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
6794 if (_PMessage !=
NULL)
6797 _PMessage->add_ref();
7006 _PMessage->add_ref();
7030 if (_PMessage->remove_ref() == 0)
7110 template<
class _Type,
class _FunctorType = std::function<
void(_Type const&)>>
7177 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
7199 call(Scheduler& _PScheduler,
7200 _Call_method
const& _Func) :
7231 call(Scheduler& _PScheduler,
7232 _Call_method
const& _Func,
7263 call(ScheduleGroup& _PScheduleGroup,
7264 _Call_method
const& _Func) :
7296 call(ScheduleGroup& _PScheduleGroup,
7297 _Call_method
const& _Func,
7351 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
7353 if (_PMessage !=
NULL)
7390 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
7392 if (_PMessage !=
NULL)
7478 template<
class _Input,
class _Output>
7518 if (_PTarget !=
NULL)
7556 if (_PTarget !=
NULL)
7562 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
7588 _Transform_method
const& _Func,
7594 if (_PTarget !=
NULL)
7628 _Transform_method
const& _Func,
7636 if (_PTarget !=
NULL)
7668 _Transform_method
const& _Func,
7674 if (_PTarget !=
NULL)
7709 _Transform_method
const& _Func,
7717 if (_PTarget !=
NULL)
7770 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
7772 if (_PMessage !=
NULL)
7803 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
7805 if (_PMessage !=
NULL)
7960 if (_PInputMessage !=
NULL)
7971 delete _PInputMessage;
8001 while (_Msg !=
NULL)
8009 _Status = _PTarget->
propagate(_Msg,
this);
8035 _Msg = _MessageBuffer._Peek();
8054 delete _PInputQueueMessage;
8108 template<
class _Type>
8176 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
8206 _Initialize(_Value, _PTarget, _Repeating, &_Scheduler);
8236 timer(ScheduleGroup& _ScheduleGroup,
unsigned int _Ms, _Type
const&
_Value,
_Inout_opt_ ITarget<_Type> *_PTarget =
NULL,
bool _Repeating =
false) :
8514 _M_fRepeating = _Repeating;
8516 _M_fReferencedScheduler =
false;
8523 if (_PScheduleGroup ==
NULL && _PScheduler ==
NULL)
8528 _M_fReferencedScheduler =
true;
8531 _M_pScheduler = _PScheduler;
8534 if (_PTarget !=
NULL)
8553 if (_M_pMessage !=
NULL)
8586 template<
class _Type>
8640 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
8780 ::Concurrency::receive<_Type>(
this);
8828 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
8831 if (_PMessage !=
NULL)
8888 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
8891 if (_PMessage !=
NULL)
9151 template<
class _Type, join_type _Jtype = non_greedy>
9152 class join :
public propagator_block<single_link_registry<ITarget<std::vector<_Type>>>, multi_link_registry<ISource<_Type>>>
9216 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
9236 join(Scheduler& _PScheduler,
size_t _NumInputs)
9293 join(ScheduleGroup& _PScheduleGroup,
size_t _NumInputs)
9323 join(ScheduleGroup& _PScheduleGroup,
size_t _NumInputs,
filter_method const& _Filter)
9379 bool _Found =
false;
9382 if (*_Iter == _PSource)
9400 bool fIsGreedy = (_Jtype ==
greedy);
9601 bool fIsGreedy = (_Jtype ==
greedy);
9616 runtime_object_identity _Saved_id;
9628 if (_Saved_id == -1)
9639 if (_Saved_id != -1)
9644 if ((_PSource !=
NULL) && _PSource->
reserve(_Saved_id,
this))
9698 while (_Msg !=
NULL)
9706 _Status = _PTarget->
propagate(_Msg,
this);
9732 _Msg = _MessageBuffer._Peek();
9753 std::vector<ISource<_Type> *> _Sources;
9756 while (*_Iter !=
NULL)
9760 if (_PSource ==
NULL)
9765 _Sources.push_back(_PSource);
9791 for (
size_t j = 0; j <
i; j++)
9825 std::vector<_Type> _OutputVector;
9837 return (
new message<std::vector<_Type>>(_OutputVector));
9869 memset(
_M_savedIdBuffer, -1,
sizeof(runtime_object_identity) * _NumInputs);
9912 : _M_count(_NumInputs),
9913 _M_messages(new
message<_Type>*[_NumInputs])
9921 delete _M_messages[
i];
9939 : _M_count(_NumInputs),
9940 _M_savedIds(new runtime_object_identity[_NumInputs])
9942 memset(_M_savedIds, -1,
sizeof(runtime_object_identity) * _NumInputs);
9977 template<
class _Type>
10040 virtual void _Reset() = 0;
10141 if (_PSource ==
NULL)
10143 throw std::invalid_argument(
"_PSource");
10154 if (_PTarget !=
NULL)
10193 template<
class _Type>
10470 if (_PSource ==
NULL)
10533 if (_PSource !=
NULL)
10581 template<
class _Type>
10787 runtime_object_identity _Saved_id;
10794 if (_Saved_id == -1)
10805 if (_Saved_id != -1)
10810 if ((_PSource !=
NULL) && _PSource->
reserve(_Saved_id,
this))
10850 bool _FDone =
false;
10975 template<
class _Type>
11189 bool _Ret_val =
false;
11197 if (_PSource !=
NULL)
11200 runtime_object_identity _SavedId = _InterlockedExchange((
volatile long *) &
_M_savedId, -1);
11202 _Ret_val = _PSource->
reserve(_SavedId,
this);
11236 runtime_object_identity _OldId =
NULL;
11237 _OldId = _InterlockedExchange((
volatile long *) &
_M_reservedId, -1);
11253 bool retVal =
false;
11303 if (_InterlockedExchange((
volatile long *) &
_M_savedId, _PMessage->
msg_id()) == -1)
11419 template<
class _Type>
11447 _Initialize_choices<0>();
11450 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
11477 _Initialize_choices<0>();
11507 _Initialize_choices<0>();
11541 _Choice._M_pSingleAssignment =
NULL;
11558 _Delete_choices<0>();
11610 template <
typename _Payload_type>
11770 template<
int _Index>
11778 template<
int _Index>
11781 std::tuple_element_t<_Index, _Type> _Item = std::get<_Index>(
_M_sourceTuple);
11799 _Initialize_choices<_Index + 1>();
11807 template<>
void _Initialize_choices<std::tuple_size<_Type>::value>()
11816 template<
int _Index>
11821 _Delete_choices<_Index + 1>();
11829 template<>
void _Delete_choices<std::tuple_size<_Type>::value>()
11858 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
11890 template<
typename _Type1,
typename _Type2,
typename... _Types>
11891 choice<std::tuple<_Type1, _Type2, _Types...>>
11892 make_choice(Scheduler& _PScheduler, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
11894 return choice<std::tuple<_Type1, _Type2, _Types...>>(_PScheduler,
std::make_tuple(_Item1, _Item2, _Items...));
11929 template<
typename _Type1,
typename _Type2,
typename... _Types>
11930 choice<std::tuple<_Type1, _Type2, _Types...>>
11931 make_choice(ScheduleGroup& _PScheduleGroup, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
11933 return choice<std::tuple<_Type1, _Type2, _Types...>>(_PScheduleGroup,
std::make_tuple(_Item1, _Item2, _Items...));
11965 template<
typename _Type1,
typename _Type2,
typename... _Types>
11966 choice<std::tuple<_Type1, _Type2, _Types...>>
11988 template <
typename... _Types>
11991 typedef std::tuple<typename std::remove_pointer_t<_Types>::source_type...>
type;
12005 template<
typename _Type,
typename _Destination_type, join_type _Jtype>
12089 _PMessage = _PSource->
accept(_PMessage->
msg_id(),
this);
12251 _InterlockedExchange(&
_M_counter, std::tuple_size<_Destination_type>::value);
12284 template<
int _Index>
12288 _Non_greedy_node_source_type * _Node =
static_cast<_Non_greedy_node_source_type *
>(_Sources[_Index]);
12293 if (_Node->_Reserve_received_message())
12295 bool _Ret_val = _Try_consume_source_messages<_Index + 1>(_Destination_tuple, _Sources);
12299 _Node->_Consume_received_message();
12303 if (_Node->_Release_received_message())
12328 template<>
bool _Try_consume_source_messages<std::tuple_size<_Type>::value>(_Destination_type &,
ISource<size_t> **)
12344 _Destination_type _Destination_tuple;
12353 while (*_Iter !=
NULL)
12357 if (_PSource ==
NULL)
12363 if (_Index >= std::tuple_size<_Type>::value)
12369 _Sources[_Index] = _PSource;
12377 if (_Index != std::tuple_size<_Type>::value)
12384 bool _IsAcquireSuccessful = _Try_consume_source_messages<0>(_Destination_tuple, _Sources);
12386 return _IsAcquireSuccessful;
12406 while (_Msg !=
NULL)
12414 _Status = _PTarget->
propagate(_Msg,
this);
12440 _Msg = _MessageBuffer._Peek();
12451 _Destination_type _Destination_tuple;
12460 while (*_Iter !=
NULL)
12464 if (_PSource ==
NULL)
12471 if (_Index >= std::tuple_size<_Type>::value)
12477 _Sources[_Index] = *_Iter;
12484 if (_Index != std::tuple_size<_Type>::value)
12491 _Populate_destination_tuple<0>(_Destination_tuple, _Sources);
12519 template<
int _Index>
12523 _Order_node_base_source_type * _Node =
static_cast<_Order_node_base_source_type *
>(_Sources[_Index]);
12525 std::get<_Index>(_Destination_tuple) = _Node->
value();
12528 _Populate_destination_tuple<_Index + 1>(_Destination_tuple, _Sources);
12536 template<>
void _Populate_destination_tuple<std::tuple_size<_Type>::value>(_Destination_type &,
ISource<size_t> **)
12580 template<
typename _Type, join_type _Jtype = non_greedy>
12610 _Initialize_joins<0>();
12613 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
12640 _Initialize_joins<0>();
12669 _M_pJoinNode =
new _Join_node<_Type, _Destination_type, _Jtype>(_PScheduleGroup);
12670 _Initialize_joins<0>();
12704 _Join._M_pJoinNode =
NULL;
12721 _Delete_joins<0>();
12880 template<
int _Index>
12883 template<
int _Index>
12893 template<
int _Index>
12896 std::tuple_element_t<_Index, _Type> _Item = std::get<_Index>(
_M_sourceTuple);
12905 _Order_node_element =
new _Non_greedy_node_source_type(*
_M_pScheduleGroup, _Item, _Index);
12909 _Order_node_element =
new _Non_greedy_node_source_type(*
_M_pScheduler, _Item, _Index);
12913 _Order_node_element =
new _Non_greedy_node_source_type(_Item, _Index);
12922 _Order_node_element =
new _Greedy_node_source_type(*
_M_pScheduleGroup, _Item, _Index);
12926 _Order_node_element =
new _Greedy_node_source_type(*
_M_pScheduler, _Item, _Index);
12930 _Order_node_element =
new _Greedy_node_source_type(_Item, _Index);
12935 _Initialize_joins<_Index + 1>();
12943 template<>
void _Initialize_joins<std::tuple_size<_Type>::value>()
12954 template<
int _Index>
12959 _Delete_joins<_Index + 1>();
12967 template<>
void _Delete_joins<std::tuple_size<_Type>::value>()
12996 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
13028 template<
typename _Type1,
typename _Type2,
typename... _Types>
13030 make_join(Scheduler& _PScheduler, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
13067 template<
typename _Type1,
typename _Type2,
typename... _Types>
13068 multitype_join<std::tuple<_Type1, _Type2, _Types...>>
13069 make_join(ScheduleGroup& _PScheduleGroup, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
13071 return multitype_join<std::tuple<_Type1, _Type2, _Types...>>(_PScheduleGroup,
std::make_tuple(_Item1, _Item2, _Items...));
13103 template<
typename _Type1,
typename _Type2,
typename... _Types>
13104 multitype_join<std::tuple<_Type1, _Type2, _Types...>>
13111 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
13144 template<
typename _Type1,
typename _Type2,
typename... _Types>
13145 multitype_join<std::tuple<_Type1, _Type2, _Types...>,
greedy>
13146 make_greedy_join(Scheduler& _PScheduler, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
13148 return multitype_join<std::tuple<_Type1, _Type2, _Types...>,
greedy>(_PScheduler,
std::make_tuple(_Item1, _Item2, _Items...));
13183 template<
typename _Type1,
typename _Type2,
typename... _Types>
13184 multitype_join<std::tuple<_Type1, _Type2, _Types...>,
greedy>
13185 make_greedy_join(ScheduleGroup& _PScheduleGroup, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
13187 return multitype_join<std::tuple<_Type1, _Type2, _Types...>,
greedy>(_PScheduleGroup,
std::make_tuple(_Item1, _Item2, _Items...));
13219 template<
typename _Type1,
typename _Type2,
typename... _Types>
13220 multitype_join<std::tuple<_Type1, _Type2, _Types...>,
greedy>
13288 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
13469 virtual void run() = 0;
13518 agent(agent
const &);
13533 template <
class _Type>
13543 #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:11324
void decline_incoming_messages()
Indicates to the block that new messages should be declined.
Definition: agents.h:5856
_Message * _Peek()
Definition: agents.h:227
call(_Call_method const &_Func, filter_method const &_Filter)
Constructs a call messaging block.
Definition: agents.h:7168
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:9100
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:9688
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:11817
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:8611
virtual bool supports_anonymous_source()
Overrides the supports_anonymous_source method to indicate that this block can accept messages offere...
Definition: agents.h:6200
void _Swap(_Myt &_Right)
Definition: agents.h:362
volatile long _M_referenceCount
Definition: agents.h:5548
_MessageProcessorType _M_messageProcessor
Processor used for asynchronous message handling
Definition: agents.h:5490
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:8290
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:8744
ISource< _Type > * _M_pReservedSource
Definition: agents.h:10554
~multitype_join()
Destroys the multitype_join messaging block.
Definition: agents.h:12718
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:12695
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:11717
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
#define NULL
Definition: vcruntime.h:236
propagator_block()
Constructs a propagator_block object.
Definition: agents.h:5605
unbounded_buffer()
Constructs an unbounded_buffer messaging block.
Definition: agents.h:5941
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:8510
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:11670
_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:8992
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:10139
void _Propagate_message()
Definition: agents.h:5519
ScheduleGroup * _M_pScheduleGroup
Definition: agents.h:11846
_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:11081
ISource< _Type > * _M_pReservedSource
Definition: agents.h:11376
_Message ** _M_ppTail
Definition: agents.h:113
constexpr tuple< typename _Unrefwrap< _Types >::type...> make_tuple(_Types &&..._Args)
Definition: tuple:965
_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:10271
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.
virtual void process_input_messages(_Inout_ message< _Target_type > *_PMessage)
Process input messages. This is only useful for propagator blocks, which derive from source_block ...
Definition: agents.h:5340
choice(choice &&_Choice)
Constructs a choice messaging block.
Definition: agents.h:11532
~_MessageArray()
Definition: agents.h:9918
_MessageArray _M_messageArray
Definition: agents.h:9925
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:151
virtual bool reserve_message(runtime_object_identity _MsgId)
Reserves a message previously offered by this join messaging block.
Definition: agents.h:9500
virtual void _Reset()=0
Resets the _Order_node_base and prepares it for the next propagation
_Type _M_sourceTuple
Definition: agents.h:12541
Scheduler * _M_pScheduler
Definition: agents.h:11843
_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:6946
multi_link_registry< ISource< _Type > > _SourceLinkRegistry
Definition: agents.h:5921
void _Process_message(message< _Target_type > *_PMessage)
Definition: agents.h:5510
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:11229
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:8869
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:12342
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:6878
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:11148
State _M_state
Definition: agents.h:8465
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:9130
_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:11353
join(size_t _NumInputs)
Constructs a join messaging block.
Definition: agents.h:9182
unsigned int _Count
Definition: xcomplex:668
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:12842
virtual void link_source(_Inout_ ISource< _Source_type > *_PSource)
Links a specified source block to this propagator_block object.
Definition: agents.h:5763
virtual void process_input_messages(_Inout_ message< _Source_type > *_PMessage)
Processes messages that are received as inputs.
Definition: agents.h:4826
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:5420
_SourceLinkRegistry::type::source_type _Source_type
The type of the payload for the incoming message to this propagator_block.
Definition: agents.h:5584
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:6838
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:13221
virtual void unlink_target(_Inout_ ITarget< size_t > *_PTarget)
Unlinks a target block from this choice messaging block.
Definition: agents.h:11639
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:10558
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:12955
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:8930
multi_link_registry< ISource< _Type > > _SourceLinkRegistry
Definition: agents.h:7120
~_Reserving_node()
Cleans up any resources that may have been created by the _Reserving_node.
Definition: agents.h:10366
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:5500
::Concurrency::details::_Queue< message< _Destination_type > > _M_messageBuffer
Definition: agents.h:12549
The agent has been started, but not entered its run method.
Definition: agents.h:13247
virtual bool supports_anonymous_source()
Overrides the supports_anonymous_source method to indicate that this block can accept messages offere...
Definition: agents.h:6817
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:8805
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:8392
_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
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:9336
virtual void link_target(_Inout_ ITarget< _Destination_type > *_PTarget)
Links a target block to this multitype_join messaging block.
Definition: agents.h:12741
void _Delete_stored_messages()
Deletes all messages currently stored in this message block. Should be called by the destructor to en...
Definition: agents.h:8545
_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:6496
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:13511
_TargetLinkRegistry _M_connectedTargets
Connected targets
Definition: agents.h:5484
~_Order_node_base()
Cleans up any resources that may have been created by the _Order_node.
Definition: agents.h:9997
void _Initialize_choices()
Constructs and initializes a _Reserving_node for each tuple messaging block passed in...
Definition: agents.h:11779
runtime_object_identity _M_savedId
Definition: agents.h:11382
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:8633
_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:7075
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:11053
size_t _M_index
Definition: agents.h:1395
choice(_Type _Tuple)
Constructs a choice messaging block.
Definition: agents.h:11444
overwrite_buffer< agent_status > _M_status
Holds the current status of the agent.
Definition: agents.h:13490
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:12827
virtual void unlink_source(_Inout_ ISource< _Source_type > *_PSource)
Unlinks a specified source block from this propagator_block object.
Definition: agents.h:5778
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:9470
virtual void release(runtime_object_identity _MsgId, _Inout_ ITarget< size_t > *_PTarget)
Releases a previous successful message reservation.
Definition: agents.h:11732
void _Reset()
Resets the _Greedy_node and prepares it for the next propagation
Definition: agents.h:10767
_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:11187
Helper class used in multi-type greedy join blocks Ordered node is a single-target, single-source ordered propagator block
Definition: agents.h:10582
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:7118
virtual ~source_block()
Destroys the source_block object.
Definition: agents.h:4913
::Concurrency::details::_ReentrantPPLLock _M_resetLock
Definition: agents.h:10951
virtual bool supports_anonymous_source()
Overrides the supports_anonymous_source method to indicate that this block can accept messages offere...
Definition: agents.h:7412
_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:12546
Helper class used in multi-type choice blocks Ordered node is a single-target, single-source ordered ...
Definition: agents.h:10194
join_type
The type of a join messaging block.
Definition: agents.h:9118
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:12981
virtual void release_ref(_Inout_ ITarget< size_t > *_PTarget)
Releases a reference count on this choice messaging block.
Definition: agents.h:11764
_Type _M_sourceTuple
Definition: agents.h:11840
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:9580
Definition: agents.h:11979
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:8127
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:12858
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:10353
#define _Out_writes_opt_(size)
Definition: sal.h:346
_Payload_type const & value()
Gets the message whose index was selected by the choice messaging block.
Definition: agents.h:11611
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:13105
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:12978
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:10976
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:10198
void pause()
Stops the timer messaging block. If it is a repeating timer messaging block, it can be restarted with...
Definition: agents.h:8303
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:12057
_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:10684
An event type that represents the name for an object
Definition: concrt.h:5691
message< _Type > * _M_pReceiveMessage
Definition: agents.h:10167
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:11388
A timer messaging block is a single-target source_block capable of sending a message to its target af...
Definition: agents.h:8109
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:6176
_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:13257
_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:10245
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:11590
_Type & reference
Definition: agents.h:261
virtual void process_input_messages(_Inout_ message< _Target_type > *_PMessage)
Process input messages. This is only useful for propagator blocks, which derive from source_block ...
Definition: agents.h:5808
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:9743
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
virtual bool reserve(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:3585
bool has_value() const
Checks whether this single_assignment messaging block has been initialized with a value yet...
Definition: agents.h:8760
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:9520
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:11967
multi_link_registry< ISource< _Type > > _SourceLinkRegistry
Definition: agents.h:10980
The timer has started and been paused.
Definition: agents.h:8137
A multitype_join messaging block is a multi-source, single-target messaging block that combines toget...
Definition: agents.h:12581
void _Delete_stored_messages()
Deletes all messages currently stored in this message block. Should be called by the destructor to en...
Definition: agents.h:9077
runtime_object_identity * _M_savedIds
Definition: agents.h:9936
virtual bool reserve_message(runtime_object_identity _MsgId)
Reserves a message previously offered by this single_assignment messaging block.
Definition: agents.h:8963
void _Populate_destination_tuple(_Destination_type &_Destination_tuple, ISource< size_t > **_Sources)
Copies payloads from all sources to destination tuple.
Definition: agents.h:12520
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:5917
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:11251
overwrite_buffer const & operator=(overwrite_buffer const &)
unbounded_buffer(filter_method const &_Filter)
Constructs an unbounded_buffer messaging block.
Definition: agents.h:5964
multitype_join(_Type _Tuple)
Constructs a multitype_join messaging block.
Definition: agents.h:12607
_Queue()
Definition: agents.h:122
size_t _M_count
Definition: agents.h:9935
_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:11991
overwrite_buffer(filter_method const &_Filter)
Constructs an overwrite_buffer messaging block.
Definition: agents.h:6571
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:12199
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:9562
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:8132
_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:7001
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:5896
virtual bool reserve_message(runtime_object_identity _MsgId)
Reserves a message previously offered by the source.
Definition: agents.h:12153
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:12035
::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:10197
ScheduleGroup * _M_pScheduleGroup
Definition: agents.h:13512
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 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:7380
_Type dequeue()
Removes an item from the unbounded_buffer messaging block.
Definition: agents.h:6111
virtual void resume_propagation()
Resumes propagation after a reservation has been released.
Definition: agents.h:6967
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:5640
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:12231
volatile bool _M_fIsInitialized
Definition: agents.h:10561
_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:13273
_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:9911
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:8432
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:10386
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:7448
virtual void link_target(_Inout_ ITarget< size_t > *_PTarget)
Links a target block to this choice messaging block.
Definition: agents.h:11627
#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:9094
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:12048
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:10416
single_link_registry< ITarget< size_t > > _TargetLinkRegistry
Definition: agents.h:10585
::Concurrency::details::_Queue< message< std::vector< _Type > > > _M_messageBuffer
Definition: agents.h:9959
runtime_object_identity _M_reservedId
Definition: agents.h:11385
single_link_registry< ITarget< size_t > > _TargetLinkRegistry
Definition: agents.h:10979
virtual message< _Type > * consume(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:3591
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:9050
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:6549
_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:6526
Definition: agents.h:9906
multi_link_registry< ISource< _Type > > _SourceLinkRegistry
Definition: agents.h:6530
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:8277
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:9020
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:12753
virtual void resume_propagation()
Resumes propagation after a reservation has been released.
Definition: agents.h:6292
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:12585
virtual void link_target_notification(_Inout_ ITarget< _Destination_type > *)
Notification that a target was linked to this source.
Definition: agents.h:12215
~choice()
Destroys the choice messaging block.
Definition: agents.h:11555
_Type value()
Gets a reference to the current payload of the message being stored in the overwrite_buffer messaging...
Definition: agents.h:6716
bool _M_fRepeating
Definition: agents.h:8471
_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:8492
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:9938
volatile long _M_iteratorCount
Definition: agents.h:1724
std::vector< _Type > _OutputType
Definition: agents.h:9164
_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:11748
virtual void unlink_targets()
Unlinks all targets from this choice messaging block.
Definition: agents.h:11652
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:12010
~call()
Destroys the call messaging block.
Definition: agents.h:7311
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:12728
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:12894
source_link_manager()
Constructs a source_link_manager object.
Definition: agents.h:1486
multi_link_registry< ISource< _Type > > _SourceLinkRegistry
Definition: agents.h:10586
::Concurrency::details::_ReentrantPPLLock _M_internalLock
Definition: agents.h:4259
message< _Type > ** _M_messages
Definition: agents.h:9909
The target accepted the message.
Definition: agents.h:1746
message< _Type > * _M_pMessage
Definition: agents.h:3955
::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:12009
multi_link_registry< ITarget< _Type > > _TargetLinkRegistry
Definition: agents.h:5920
virtual _CONCRTIMP ~agent()
Destroys the agent.
void enable_batched_processing()
Enables batched processing for this block.
Definition: agents.h:5396
_SyncOriginator()
Definition: agents.h:3694
volatile long _M_fCancelable
Definition: agents.h:13505
_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:10024
::Concurrency::details::_ReentrantPPLLock _M_internalLock
Internal lock used for the following synchronization:
Definition: agents.h:5546
::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:12984
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:9152
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:7078
void _Delete_stored_messages()
Deletes all messages currently stored in this message block. Should be called by the destructor to en...
Definition: agents.h:12501
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:8419
_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:5883
bool has_value() const
Checks whether this choice messaging block has been initialized with a value yet. ...
Definition: agents.h:11574
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:6138
Definition: agents.h:9933
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:10077
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:10500
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:10709
_Non_greedy_node const & operator=(_Non_greedy_node const &)
virtual void unlink_target(ITarget< _Type > *_PTarget)
Definition: agents.h:3548
virtual void unlink_sources()
Unlinks all source blocks from this propagator_block object.
Definition: agents.h:5791
bool enqueue(_Type const &_Item)
Adds an item to the unbounded_buffer messaging block.
Definition: agents.h:6099
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:6246
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:12123
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:8474
_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:10657
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:10520
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:5382
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:10012
_Type const & value()
Gets a reference to the current payload of the message being stored in the single_assignment messagin...
Definition: agents.h:8776
An event type that represents the initiation of some processing
Definition: concrt.h:5655
An event type that represents the deletion of an object
Definition: concrt.h:5667
message< size_t > * _M_pSendMessage
Definition: agents.h:10170
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:13534
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:6315
~unbounded_buffer()
Destroys the unbounded_buffer messaging block.
Definition: agents.h:6080
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:10948
agent_status
The valid states for an agent.
Definition: agents.h:13237
multi_link_registry< ITarget< _Type > > _TargetLinkRegistry
Definition: agents.h:6529
bool _internal_send(ITarget< _Type > *_PTarget, _Type const &_Value)
Definition: agents.h:4181
_Join_node< _Type, _Destination_type, _Jtype > * _M_pJoinNode
Definition: agents.h:12975
unbounded_buffer const & operator=(unbounded_buffer const &)
virtual void unlink_targets()
Unlinks all targets from this multitype_join messaging block.
Definition: agents.h:12762
_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:11135
source_link_manager< _LinkRegistry > _MyContainer
Definition: agents.h:1249
volatile size_t _M_messagesRemaining
Definition: agents.h:9902
_Type _M_value
Definition: agents.h:8468
~_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:11027
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:6408
virtual void link_target_notification(_Inout_ ITarget< size_t > *)
Notification that a target was linked to this source.
Definition: agents.h:10118
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:12881
_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:10130
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:10846
_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:1513
A single_assignment messaging block is a multi-target, multi-source, ordered propagator_block capable...
Definition: agents.h:8587
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.
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:8121
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:9978
_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:11002
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:5445
size_t _M_index
Definition: agents.h:10173
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
size_t _M_index
Definition: agents.h:576
_Type type
A type alias for _Type .
Definition: agents.h:11565
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:12780
_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:8477
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:5596
~source_link_manager()
Destroys the source_link_manager object.
Definition: agents.h:1494
runtime_object_identity * _M_savedIdBuffer
Definition: agents.h:9953
runtime_object_identity _M_reservedId
Reserved message ID
Definition: agents.h:5478
_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:6266
virtual void link_target(ITarget< _Type > *_PTarget)
Definition: agents.h:3673
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:9908
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:12449
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:7337
_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:8483
virtual void release_message(runtime_object_identity _MsgId)
Releases a previous message reservation.
Definition: agents.h:9533
_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:9856
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:8446
_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:10325
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:5826
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:11420
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:11300
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:8337
void _Wait_on_ref(long _RefCount=0)
Definition: agents.h:5528
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:9882
filter_method * _M_pFilter
The filter function which determines whether offered messages should be accepted. ...
Definition: agents.h:5889
~overwrite_buffer()
Destroys the overwrite_buffer messaging block.
Definition: agents.h:6684
_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:7433
~_SavedMessageIdArray()
Definition: agents.h:9945
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:10920
virtual void release_message(runtime_object_identity)
Releases a previous message reservation.
Definition: agents.h:10092
_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:12972
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
#define _In_reads_(size)
Definition: sal.h:316
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:10890
void _Release_ref()
Definition: agents.h:4243
ITarget< typename _Block::source_type > *volatile _M_pLinkedTarget
Definition: agents.h:1733
_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:10632
_Myt & operator=(const _Myt &_Right)
Definition: agents.h:283
single_link_registry< ITarget< std::vector< _Type > > > _TargetLinkRegistry
Definition: agents.h:9155
call(_Call_method const &_Func)
Constructs a call messaging block.
Definition: agents.h:7143
#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:11694
virtual bool reserve_message(runtime_object_identity)
Reserves a message previously offered by the source.
Definition: agents.h:10055
_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:5841
void _Propagate_priority_order(::Concurrency::details::_Queue< message< _Target_type >> &_MessageBuffer)
Propagate messages in priority order
Definition: agents.h:12396
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:5688
~_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:9033
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:6368
volatile bool _M_fIsInitialized
Definition: agents.h:7081
_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:12083
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:6742
_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:11107
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:7043
_CRT_BEGIN_C_HEADER typedef void(__CRTDECL *unexpected_handler)()
runtime_object_identity _M_savedId
Definition: agents.h:10955
_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:12006
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:6980
_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:10736
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:10748
Definition: concrt.h:4144
source_link_manager< _SourceLinkRegistry > _SourceLinkManager
The type of the source_link_manager this propagator_block.
Definition: agents.h:5590
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:5865
void _Delete_stored_messages()
Deletes all messages currently stored in this message block. Should be called by the destructor to en...
Definition: agents.h:6461
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:11837
_Message type
Definition: agents.h:119
void _Reset()
Resets the _Order_node and prepares it for the next propagation
Definition: agents.h:11168
_Join_node()
Constructs a join within the default scheduler, and places it on any schedule group of the scheduler'...
Definition: agents.h:12022
_SavedMessageIdArray _M_savedMessageIdArray
Definition: agents.h:9950
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:6216
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:7111
ITarget< _Target_type > * _M_pReservedFor
Connected target that is holding a reservation
Definition: agents.h:5472
~timer()
Destroys a timer messaging block.
Definition: agents.h:8247
_MyContainer * _M_pNetwork_link
Definition: agents.h:573
virtual ~propagator_block()
Destroys a propagator_block object.
Definition: agents.h:5613
long __cdecl _InterlockedIncrement(long volatile *)
join(size_t _NumInputs, filter_method const &_Filter)
Constructs a join messaging block.
Definition: agents.h:9208
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
virtual void release(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:3599
_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:9546
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:6786
::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:5750
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:8112
_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:6279
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:9986
_Network_link_iterator(_Myt const &_Right)
Copy construct an iterator
Definition: agents.h:498
::Concurrency::details::_ReentrantPPLLock _M_resetLock
Definition: agents.h:11379
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
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:12804
::Concurrency::details::_Queue< message< _Type > > _M_messageBuffer
Message queue used to store messages
Definition: agents.h:6490
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
_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:6700
_In_ int _Value
Definition: setjmp.h:173
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:12173
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:6346
::Concurrency::details::_NonReentrantPPLLock _M_propagationLock
Definition: agents.h:9956
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:8364
multi_link_registry< ISource< _Type > > _SourceLinkRegistry
Definition: agents.h:9156
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:12186
::Concurrency::details::_NonReentrantPPLLock _M_propagationLock
Definition: agents.h:9097
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:8462
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:11834
virtual void resume_propagation()
Resumes propagation after a reservation has been released
Definition: agents.h:10105
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:6913
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:6484
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
_Size
Definition: vcruntime_string.h:36
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:8591
_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:5577
_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:10299
Greedy join messaging blocks immediately accept a message upon propagation. This is more efficient...
Definition: agents.h:9124
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:7424
constexpr const _Ty &() _Right
Definition: algorithm:3591
virtual void release_message(runtime_object_identity _MsgId)
Releases a previous message reservation.
Definition: agents.h:9006
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:5434
The agent has been created but not started.
Definition: agents.h:13242
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:5454
multi_link_registry< ITarget< _Type > > _TargetLinkRegistry
Definition: agents.h:8590
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:12285
virtual void release_ref(_Inout_ ITarget< _Destination_type > *_PTarget)
Releases a reference count on this multiple_join messaging block.
Definition: agents.h:12874
_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:10608
_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:10220
The agent has started.
Definition: agents.h:13252
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:10945
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:13262
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:8170
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:10457
virtual void release_message(runtime_object_identity _MsgId)
Releases a previous message reservation.
Definition: agents.h:8404
The timer has been stopped.
Definition: agents.h:8142
#define _InterlockedIncrementSizeT(_Target)
Definition: concrt.h:96
volatile long _M_fStartable
Definition: agents.h:13498
_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:9367