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
57 typedef ::Concurrency::details::_NonReentrantPPLLock::_Scoped_lock
_NR_lock;
64 typedef ::Concurrency::details::_ReentrantPPLLock::_Scoped_lock
_R_lock;
104 template<
class _Message>
118 typedef typename _Message
type;
144 *_M_ppTail = _Element;
145 _Element->_M_pNext =
NULL;
146 _M_ppTail = &(_Element->_M_pNext);
157 bool _Result =
false;
161 if (_M_pHead == _OldElement)
163 _M_pHead = _OldElement->_M_pNext;
164 if (_M_pHead ==
NULL)
169 _OldElement->_M_pNext =
NULL;
175 _Message * _Next =
NULL;
176 for (_Message * _Node = _M_pHead; _Node !=
NULL; _Node = _Next)
178 _Next = _Node->_M_pNext;
180 if (_Node->_M_pNext == _OldElement)
182 _Node->_M_pNext = _OldElement->_M_pNext;
184 if (_Node->_M_pNext ==
NULL && _M_count == 1)
189 _OldElement->_M_pNext =
NULL;
205 if (_M_pHead ==
NULL)
212 _M_pHead = _Result->_M_pNext;
213 if (_M_pHead ==
NULL)
218 _Result->_M_pNext =
NULL;
238 if (_Msg ==
NULL || _Msg->msg_id() != _MsgId)
253 template<
class _Type>
294 for (
size_t _I=0; _I <
_Size; _I++)
403 for (
size_t _I = 0; _I <
_M_size; _I++)
433 template <
class _Type>
436 return reinterpret_cast<__int64
>(_PObject);
469 template<
class _Block>
594 template<
class _Block>
658 virtual bool remove(_EType
_Link) = 0;
682 virtual size_t count() = 0;
695 virtual iterator
begin() = 0;
732 template<
class _Block>
907 template<
class _Block>
1059 while (_Index < _Size)
1103 size_t _Insert_pos = 0;
1114 for (
size_t _Index = 0; _Index <
_Size; _Index++)
1120 _Insert_pos = _Index + 1;
1130 if (_Insert_pos < _Size)
1240 template<
class _LinkRegistry>
1376 const_reference
_Get(
size_t _Pos)
const
1417 template<
class _LinkRegistry>
1473 typedef ::Concurrency::details::_ReentrantPPLLock
_LockType;
1570 bool _Removed =
false;
1571 _EType _RemovedLink =
NULL;
1593 _RemovedLink =
_Link;
1605 if (_RemovedLink !=
NULL)
1607 _RemovedLink->release_ref(_LinkedTarget);
1652 for (
size_t _I=0; _I <
_Size; _I++)
1654 _LinksToRemove[_I]->release_ref(_LinkedTarget);
1774 template<
class _Type>
1777 friend class ::Concurrency::details::_Queue<message<_Type>>;
1843 throw std::invalid_argument(
"_Msg");
1928 template<
class _Type>
1969 virtual void wait() = 0;
2007 template<
class _Type>
2157 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
2170 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
2276 long _Messages_processed = 0;
2281 bool _StopProcessing =
false;
2289 _Messages_processed +=
_Count;
2292 volatile long _Orig = _InterlockedExchangeAdd((
volatile long *) &
_M_queuedDataCount, -_Count);
2294 if (_Orig == _Count)
2300 if (_StopProcessing)
2314 return _Messages_processed;
2322 for(
int _I = 0; _I <
_Count; _I++)
2448 template<
class _Type>
2596 template<
class _Type>
2794 template<
class _SourceLinkRegistry,
2795 class _MessageProcessorType = ordered_message_processor<typename _SourceLinkRegistry::type::source_type>>
2866 if (_PMessage ==
NULL)
2868 throw std::invalid_argument(
"_PMessage");
2871 if (_PSource ==
NULL)
2873 throw std::invalid_argument(
"_PSource");
2913 if (_PMessage ==
NULL)
2915 throw std::invalid_argument(
"_PMessage");
2918 if (_PSource ==
NULL)
2920 throw std::invalid_argument(
"_PSource");
3056 if (_Filter !=
NULL)
3177 throw invalid_operation(
"To use batched processing, you must override process_input_messages in the message block.");
3226 template<
class _TargetLinkRegistry,
3285 if (_PTarget ==
NULL)
3287 throw std::invalid_argument(
"_PTarget");
3310 if (_PTarget ==
NULL)
3312 throw std::invalid_argument(
"_PTarget");
3367 if (_PTarget ==
NULL)
3369 throw std::invalid_argument(
"_PTarget");
3405 if (_PTarget ==
NULL)
3407 throw std::invalid_argument(
"_PTarget");
3461 if (_PTarget ==
NULL)
3463 throw std::invalid_argument(
"_PTarget");
3510 if (_PTarget ==
NULL)
3512 throw std::invalid_argument(
"_PTarget");
3559 if (_PTarget !=
NULL)
3700 throw invalid_operation(
"To use batched processing, you must override propagate_output_messages in the message block.");
3713 throw invalid_operation(
"To use ordered message processing, you must override propagate_to_any_targets in the message block.");
3924 template<
class _TargetLinkRegistry,
class _SourceLinkRegistry,
3993 if (_PMessage ==
NULL)
3995 throw std::invalid_argument(
"_PMessage");
3998 if (_PSource ==
NULL)
4000 throw std::invalid_argument(
"_PSource");
4037 if (_PMessage ==
NULL)
4039 throw std::invalid_argument(
"_PMessage");
4042 if (_PSource ==
NULL)
4044 throw std::invalid_argument(
"_PSource");
4157 throw invalid_operation(
"To use batched processing, you must override process_input_messages in the message block.");
4190 if (_Filter !=
NULL)
4263 template<
class _Type>
4311 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
4440 return Concurrency::send<_Type>(
this, _Item);
4452 return receive<_Type>(
this);
4486 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
4488 if (_PMessage !=
NULL)
4517 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
4519 if (_PMessage !=
NULL)
4687 if (_PMessage !=
NULL)
4719 if(_PInputMessage ==
NULL)
4757 while (_Msg !=
NULL)
4765 _Status = _PTarget->
propagate(_Msg,
this);
4791 _Msg = _MessageBuffer._Peek();
4864 template<
class _Type>
4910 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
5050 return receive<_Type>(
this);
5082 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
5088 if (_PMessage !=
NULL)
5091 _PMessage->add_ref();
5120 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
5126 if (_PMessage !=
NULL)
5129 _PMessage->add_ref();
5338 _PMessage->add_ref();
5362 if (_PMessage->remove_ref() == 0)
5442 template<
class _Type,
class _FunctorType = std::tr1::function<
void(_Type const&)>>
5504 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
5526 call(Scheduler& _PScheduler,
5527 _Call_method
const& _Func) :
5558 call(Scheduler& _PScheduler,
5559 _Call_method
const& _Func,
5590 call(ScheduleGroup& _PScheduleGroup,
5591 _Call_method
const& _Func) :
5623 call(ScheduleGroup& _PScheduleGroup,
5624 _Call_method
const& _Func,
5678 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
5680 if (_PMessage !=
NULL)
5717 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
5719 if (_PMessage !=
NULL)
5805 template<
class _Input,
class _Output>
5838 if (_PTarget !=
NULL)
5876 if (_PTarget !=
NULL)
5882 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
5908 _Transform_method
const& _Func,
5914 if (_PTarget !=
NULL)
5948 _Transform_method
const& _Func,
5956 if (_PTarget !=
NULL)
5988 _Transform_method
const& _Func,
5994 if (_PTarget !=
NULL)
6029 _Transform_method
const& _Func,
6037 if (_PTarget !=
NULL)
6090 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
6092 if (_PMessage !=
NULL)
6123 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
6125 if (_PMessage !=
NULL)
6280 if (_PInputMessage !=
NULL)
6291 delete _PInputMessage;
6321 while (_Msg !=
NULL)
6329 _Status = _PTarget->
propagate(_Msg,
this);
6355 _Msg = _MessageBuffer._Peek();
6374 delete _PInputQueueMessage;
6428 template<
class _Type>
6492 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
6522 _Initialize(_Value, _PTarget, _Repeating, &_Scheduler);
6830 _M_fRepeating = _Repeating;
6832 _M_fReferencedScheduler =
false;
6839 if (_PScheduleGroup ==
NULL && _PScheduler ==
NULL)
6844 _M_fReferencedScheduler =
true;
6847 _M_pScheduler = _PScheduler;
6850 if (_PTarget !=
NULL)
6869 if (_M_pMessage !=
NULL)
6902 template<
class _Type>
6949 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
7089 receive<_Type>(
this);
7137 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
7140 if (_PMessage !=
NULL)
7197 _PMessage = _PSource->accept(_PMessage->msg_id(),
this);
7200 if (_PMessage !=
NULL)
7460 template<
class _Type, join_type _Jtype = non_greedy>
7461 class join :
public propagator_block<single_link_registry<ITarget<std::vector<_Type>>>, multi_link_registry<ISource<_Type>>>
7516 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
7536 join(Scheduler& _PScheduler,
size_t _NumInputs)
7593 join(ScheduleGroup& _PScheduleGroup,
size_t _NumInputs)
7623 join(ScheduleGroup& _PScheduleGroup,
size_t _NumInputs,
filter_method const& _Filter)
7679 bool _Found =
false;
7682 if (*_Iter == _PSource)
7700 bool fIsGreedy = (_Jtype ==
greedy);
7901 bool fIsGreedy = (_Jtype ==
greedy);
7916 runtime_object_identity _Saved_id;
7928 if (_Saved_id == -1)
7939 if (_Saved_id != -1)
7944 if ((_PSource !=
NULL) && _PSource->
reserve(_Saved_id,
this))
7998 while (_Msg !=
NULL)
8006 _Status = _PTarget->
propagate(_Msg,
this);
8032 _Msg = _MessageBuffer._Peek();
8053 std::vector<ISource<_Type> *> _Sources;
8056 while (*_Iter !=
NULL)
8060 if (_PSource ==
NULL)
8065 _Sources.push_back(_PSource);
8091 for (
size_t j = 0; j <
i; j++)
8125 std::vector<_Type> _OutputVector;
8137 return (
new message<std::vector<_Type>>(_OutputVector));
8169 memset(
_M_savedIdBuffer, -1,
sizeof(runtime_object_identity) * _NumInputs);
8212 : _M_count(_NumInputs),
8221 delete _M_messages[
i];
8239 : _M_count(_NumInputs),
8240 _M_savedIds(new runtime_object_identity[_NumInputs])
8242 memset(_M_savedIds, -1,
sizeof(runtime_object_identity) * _NumInputs);
8277 template<
class _Type>
8341 virtual void _Reset() = 0;
8444 throw std::invalid_argument(
"_Index");
8447 if (_PSource ==
NULL)
8449 throw std::invalid_argument(
"_PSource");
8460 if (_PTarget !=
NULL)
8499 template<
class _Type>
8767 if (_PSource ==
NULL)
8830 if (_PSource !=
NULL)
8878 template<
class _Type>
9075 runtime_object_identity _Saved_id;
9082 if (_Saved_id == -1)
9093 if (_Saved_id != -1)
9098 if ((_PSource !=
NULL) && _PSource->
reserve(_Saved_id,
this))
9138 bool _FDone =
false;
9263 template<
class _Type>
9468 bool _Ret_val =
false;
9476 if (_PSource !=
NULL)
9479 runtime_object_identity _SavedId = _InterlockedExchange((
volatile long *) &
_M_savedId, -1);
9481 _Ret_val = _PSource->
reserve(_SavedId,
this);
9515 runtime_object_identity _OldId =
NULL;
9516 _OldId = _InterlockedExchange((
volatile long *) &
_M_reservedId, -1);
9532 bool retVal =
false;
9582 if (_InterlockedExchange((
volatile long *) &
_M_savedId, _PMessage->
msg_id()) == -1)
9698 template<
class _Type>
9726 _Initialize_choices<0>();
9729 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
9756 _Initialize_choices<0>();
9786 _Initialize_choices<0>();
9820 _Choice._M_pSingleAssignment =
NULL;
9837 _Delete_choices<0>();
9889 template <
typename _Payload_type>
10055 template<
int _Index>
10058 std::tr1::tuple_element<_Index, _Type>::type _Item = std::tr1::get<_Index>(
_M_sourceTuple);
10076 _Initialize_choices<_Index + 1>();
10084 template<>
void _Initialize_choices<std::tr1::tuple_size<_Type>::value>()
10093 template<
int _Index>
10098 _Delete_choices<_Index + 1>();
10106 template<>
void _Delete_choices<std::tr1::tuple_size<_Type>::value>()
10135 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
10167 template<
typename _Type1,
typename _Type2,
typename... _Types>
10168 choice<std::tuple<_Type1, _Type2, _Types...>>
10169 make_choice(Scheduler& _PScheduler, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
10171 return choice<std::tuple<_Type1, _Type2, _Types...>>(_PScheduler,
std::make_tuple(_Item1, _Item2, _Items...));
10206 template<
typename _Type1,
typename _Type2,
typename... _Types>
10207 choice<std::tuple<_Type1, _Type2, _Types...>>
10208 make_choice(ScheduleGroup& _PScheduleGroup, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
10210 return choice<std::tuple<_Type1, _Type2, _Types...>>(_PScheduleGroup,
std::make_tuple(_Item1, _Item2, _Items...));
10242 template<
typename _Type1,
typename _Type2,
typename... _Types>
10243 choice<std::tuple<_Type1, _Type2, _Types...>>
10265 template <
typename... _Types>
10268 typedef std::tuple<typename std::remove_pointer<_Types>::type::source_type...>
type;
10282 template<
typename _Type,
typename _Destination_type, join_type _Jtype>
10359 _PMessage = _PSource->
accept(_PMessage->
msg_id(),
this);
10521 _InterlockedExchange(&
_M_counter, std::tr1::tuple_size<_Destination_type>::value);
10554 template<
int _Index>
10565 bool _Ret_val = _Try_consume_source_messages<_Index + 1>(_Destination_tuple, _Sources);
10598 template<>
bool _Try_consume_source_messages<std::tr1::tuple_size<_Type>::value>(_Destination_type &,
ISource<size_t> **)
10614 _Destination_type _Destination_tuple;
10623 while (*_Iter !=
NULL)
10627 if (_PSource ==
NULL)
10633 if (_Index >= std::tr1::tuple_size<_Type>::value)
10639 _Sources[_Index] = _PSource;
10647 if (_Index != std::tr1::tuple_size<_Type>::value)
10654 bool _IsAcquireSuccessful = _Try_consume_source_messages<0>(_Destination_tuple, _Sources);
10656 return _IsAcquireSuccessful;
10676 while (_Msg !=
NULL)
10684 _Status = _PTarget->
propagate(_Msg,
this);
10710 _Msg = _MessageBuffer._Peek();
10721 _Destination_type _Destination_tuple;
10730 while (*_Iter !=
NULL)
10734 if (_PSource ==
NULL)
10741 if (_Index >= std::tr1::tuple_size<_Type>::value)
10747 _Sources[_Index] = *_Iter;
10754 if (_Index != std::tr1::tuple_size<_Type>::value)
10761 _Populate_destination_tuple<0>(_Destination_tuple, _Sources);
10789 template<
int _Index>
10795 std::tr1::get<_Index>(_Destination_tuple) = _Node->
value();
10798 _Populate_destination_tuple<_Index + 1>(_Destination_tuple, _Sources);
10806 template<>
void _Populate_destination_tuple<std::tr1::tuple_size<_Type>::value>(_Destination_type &,
ISource<size_t> **)
10850 template<
typename _Type, join_type _Jtype = non_greedy>
10880 _Initialize_joins<0>();
10883 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
10910 _Initialize_joins<0>();
10939 _M_pJoinNode =
new _Join_node<_Type, _Destination_type, _Jtype>(_PScheduleGroup);
10940 _Initialize_joins<0>();
10974 _Join._M_pJoinNode =
NULL;
10991 _Delete_joins<0>();
11158 template<
int _Index>
11161 std::tr1::tuple_element<_Index, _Type>::type _Item = std::tr1::get<_Index>(
_M_sourceTuple);
11198 _Initialize_joins<_Index + 1>();
11206 template<>
void _Initialize_joins<std::tr1::tuple_size<_Type>::value>()
11217 template<
int _Index>
11222 _Delete_joins<_Index + 1>();
11230 template<>
void _Delete_joins<std::tr1::tuple_size<_Type>::value>()
11259 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
11291 template<
typename _Type1,
typename _Type2,
typename... _Types>
11293 make_join(Scheduler& _PScheduler, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
11330 template<
typename _Type1,
typename _Type2,
typename... _Types>
11331 multitype_join<std::tuple<_Type1, _Type2, _Types...>>
11332 make_join(ScheduleGroup& _PScheduleGroup, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
11334 return multitype_join<std::tuple<_Type1, _Type2, _Types...>>(_PScheduleGroup,
std::make_tuple(_Item1, _Item2, _Items...));
11366 template<
typename _Type1,
typename _Type2,
typename... _Types>
11367 multitype_join<std::tuple<_Type1, _Type2, _Types...>>
11374 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
11407 template<
typename _Type1,
typename _Type2,
typename... _Types>
11408 multitype_join<std::tuple<_Type1, _Type2, _Types...>,
greedy>
11409 make_greedy_join(Scheduler& _PScheduler, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
11411 return multitype_join<std::tuple<_Type1, _Type2, _Types...>,
greedy>(_PScheduler,
std::make_tuple(_Item1, _Item2, _Items...));
11446 template<
typename _Type1,
typename _Type2,
typename... _Types>
11447 multitype_join<std::tuple<_Type1, _Type2, _Types...>,
greedy>
11448 make_greedy_join(ScheduleGroup& _PScheduleGroup, _Type1 _Item1, _Type2 _Item2, _Types... _Items)
11450 return multitype_join<std::tuple<_Type1, _Type2, _Types...>,
greedy>(_PScheduleGroup,
std::make_tuple(_Item1, _Item2, _Items...));
11482 template<
typename _Type1,
typename _Type2,
typename... _Types>
11483 multitype_join<std::tuple<_Type1, _Type2, _Types...>,
greedy>
11551 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
11732 virtual void run() = 0;
11781 agent(agent
const &);
11812 template <
class _Type>
11816 class _Blocking_recipient :
public ITarget<_Type>
11822 _M_pFilter(
NULL), _M_pConnectedTo(
NULL), _M_pMessage(
NULL), _M_fState(_NotInitialized), _M_timeout(_Timeout)
11824 _Connect(_PSource);
11829 filter_method
const& _Filter,
11831 _M_pFilter(
NULL), _M_pConnectedTo(
NULL), _M_pMessage(
NULL), _M_fState(_NotInitialized), _M_timeout(_Timeout)
11833 if (_Filter !=
NULL)
11835 _M_pFilter =
new filter_method(_Filter);
11838 _Connect(_PSource);
11842 ~_Blocking_recipient()
11847 delete _M_pMessage;
11854 _Wait_for_message();
11856 return _M_pMessage->payload;
11864 if (_PMessage ==
NULL)
11866 throw std::invalid_argument(
"_PMessage");
11869 if (_PSource ==
NULL)
11871 throw std::invalid_argument(
"_PSource");
11875 if (_M_fState == _Initialized)
11881 if (_M_pFilter !=
NULL && !(*_M_pFilter)(_PMessage->
payload))
11888 _M_pMessage = _PSource->
accept(_PMessage->
msg_id(),
this);
11890 if (_M_pMessage !=
NULL)
11893 if (_InterlockedExchange(&_M_fState, _Initialized) == _Blocked)
11908 if (_PMessage ==
NULL)
11910 throw std::invalid_argument(
"_PMessage");
11913 if (_PSource ==
NULL)
11915 throw std::invalid_argument(
"_PSource");
11930 _M_pConnectedTo = _PSrc;
11944 virtual void unlink_sources()
11946 ISource<_Type> * _PSource =
reinterpret_cast<ISource<_Type> *
>(_InterlockedExchangePointer(reinterpret_cast<void *volatile *>(&_M_pConnectedTo), (
void *)
NULL));
11947 if (_PSource !=
NULL)
11958 if (_PSource ==
NULL)
11960 throw std::invalid_argument(
"_PSource");
11975 void _Wait_for_message()
11977 bool _Timeout =
false;
11991 if (_M_fState != _Initialized)
12009 volatile long _M_fState;
12018 unsigned int _M_timeout;
12024 filter_method * _M_pFilter;
12027 if (_Filter_proc !=
NULL)
12029 _Blocking_recipient _Recipient(_Src, *_Filter_proc, _Timeout);
12030 return _Recipient._Value();
12034 _Blocking_recipient _Recipient(_Src, _Timeout);
12035 return _Recipient._Value();
12067 template <
class _Type>
12104 template <
class _Type>
12138 template <
class _Type>
12175 template <
class _Type>
12203 template <
class _Type>
12207 class _Immediate_recipient :
public ITarget<_Type>
12212 _M_pFilter(
NULL), _M_pConnectedTo(
NULL), _M_pMessage(
NULL), _M_isInitialized(0)
12214 _Connect(_PSource);
12219 filter_method
const& _Filter) :
12220 _M_pFilter(
NULL), _M_pConnectedTo(
NULL), _M_pMessage(
NULL), _M_isInitialized(0)
12222 if (_Filter !=
NULL)
12224 _M_pFilter =
new filter_method(_Filter);
12227 _Connect(_PSource);
12231 ~_Immediate_recipient()
12236 delete _M_pMessage;
12245 if (_M_pMessage !=
NULL)
12247 _value = _M_pMessage->payload;
12261 if (_PMessage ==
NULL)
12263 throw std::invalid_argument(
"_PMessage");
12266 if (_PSource ==
NULL)
12268 throw std::invalid_argument(
"_PSource");
12272 if (_M_isInitialized == 1)
12278 if (_M_pFilter !=
NULL && !(*_M_pFilter)(_PMessage->
payload))
12285 _M_pMessage = _PSource->
accept(_PMessage->
msg_id(),
this);
12289 if (_M_pMessage !=
NULL)
12292 _InterlockedExchange(&_M_isInitialized, 1);
12308 if (_PMessage ==
NULL)
12310 throw std::invalid_argument(
"_PMessage");
12313 if (_PSource ==
NULL)
12315 throw std::invalid_argument(
"_PSource");
12330 _M_pConnectedTo = _PSrc;
12344 virtual void unlink_sources()
12346 ISource<_Type> * _PSource =
reinterpret_cast<ISource<_Type> *
>(_InterlockedExchangePointer(reinterpret_cast<void *volatile *>(&_M_pConnectedTo), (
void *)
NULL));
12347 if (_PSource !=
NULL)
12357 if (_PSource ==
NULL)
12359 throw std::invalid_argument(
"_PSource");
12383 volatile long _M_isInitialized;
12386 filter_method * _M_pFilter;
12389 if (_Filter_proc !=
NULL)
12391 _Immediate_recipient _Recipient(_Src, *_Filter_proc);
12392 return _Recipient._Value(_value);
12396 _Immediate_recipient _Recipient(_Src);
12397 return _Recipient._Value(_value);
12425 template <
class _Type>
12458 template <
class _Type>
12488 template <
class _Type>
12521 template <
class _Type>
12534 template <
class _Type>
12555 throw invalid_operation(
"unlink_target is not supported on _AnonymousOriginator");
12561 throw invalid_operation(
"unlink_targets is not supported on _AnonymousOriginator");
12611 throw invalid_operation(
"acquire_ref is not supported on _AnonymousOriginator");
12616 throw invalid_operation(
"release_ref is not supported on _AnonymousOriginator");
12671 throw invalid_operation(
"Messages offered by _AnonymousOriginator shall not be postponed");
12680 throw invalid_operation(
"link_target is not supported on _AnonymousOriginator");
12691 template <
class _Type>
12719 if (_PTarget ==
NULL)
12721 throw std::invalid_argument(
"_PTarget");
12764 if (_PTarget ==
NULL)
12798 if (_PTarget ==
NULL)
12800 throw std::invalid_argument(
"_PTarget");
12820 if (_PTarget ==
NULL)
12822 throw std::invalid_argument(
"_PTarget");
12830 return accept(_MsgId, _PTarget);
12838 if (_PTarget ==
NULL)
12840 throw std::invalid_argument(
"_PTarget");
12876 if (_PTarget ==
NULL)
12878 throw std::invalid_argument(
"_PTarget");
12918 if (_PTarget ==
NULL)
12920 throw std::invalid_argument(
"_PTarget");
12978 template <
class _Type>
12996 if (_PTarget ==
NULL)
12998 throw std::invalid_argument(
"_PTarget");
13001 bool _Unlinked =
false;
13025 bool _Unlinked =
false;
13060 if (_PTarget ==
NULL)
13089 if (_PTarget ==
NULL)
13091 throw std::invalid_argument(
"_PTarget");
13111 if (_PTarget ==
NULL)
13113 throw std::invalid_argument(
"_PTarget");
13143 if (_PTarget ==
NULL)
13145 throw std::invalid_argument(
"_PTarget");
13225 if (_PTarget ==
NULL)
13227 throw std::invalid_argument(
"_PTarget");
13277 template <
class _Type>
13298 template <
class _Type>
13341 template <
class _Type>
13370 template <
class _Type>
13373 return send(&_Trg, _Data);
13398 template <
class _Type>
13427 template <
class _Type>
13430 return asend(&_Trg, _Data);
13445 template <
class _Type>
13455 #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:9603
void decline_incoming_messages()
Indicates to the block that new messages should be declined.
Definition: agents.h:4203
_Message * _Peek()
Definition: agents.h:226
call(_Call_method const &_Func, filter_method const &_Filter)
Constructs a call messaging block.
Definition: agents.h:5495
virtual void unlink_source(_Inout_ ISource< _Source_type > *_PSource)
Unlinks a specified source block from this target_block object.
Definition: agents.h:3009
_EType _M_value
Definition: agents.h:578
volatile bool _M_fIsInitialized
Definition: agents.h:7409
multitype_join const & operator=(multitype_join const &)
volatile long _M_lwtCount
A counter to indicate the number of outstanding LWTs
Definition: agents.h:2415
void _Propagate_priority_order(::Concurrency::details::_Queue< message< _Target_type >> &_MessageBuffer)
Propagate messages in priority order.
Definition: agents.h:7988
void _Delete_choices()
Deletes all _Reserving_node elements that were created in _Initialize_choices.
Definition: agents.h:10094
This class describes an exception thrown when the link_target method of a messaging block is called a...
Definition: concrt.h:1593
virtual ~_AsyncOriginator()
Definition: agents.h:12986
single_assignment()
Constructs a single_assignment messaging block.
Definition: agents.h:6920
virtual bool supports_anonymous_source()
Overrides the supports_anonymous_source method to indicate that this block can accept messages offere...
Definition: agents.h:4539
void _Swap(_Myt &_Right)
Definition: agents.h:361
volatile long _M_referenceCount
Definition: agents.h:3897
_MessageProcessorType _M_messageProcessor
Processor used for asynchronous message handling
Definition: agents.h:3839
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:3457
void stop()
Stops the timer messaging block.
Definition: agents.h:6606
virtual void unlink_sources()
Unlinks all source blocks from this target_block object.
Definition: agents.h:3022
_Block * _EType
Definition: agents.h:1251
~single_assignment()
Destroys the single_assignment messaging block.
Definition: agents.h:7053
ISource< _Type > * _M_pReservedSource
Definition: agents.h:8851
~multitype_join()
Destroys the multitype_join messaging block.
Definition: agents.h:10988
virtual ~ISource()
Destroys the ISource object.
Definition: agents.h:2604
_Network_link_iterator(_MyContainer *_PNetwork_link, size_t _Index)
Construct iterator
Definition: agents.h:488
multitype_join(multitype_join &&_Join)
Constructs a multitype_join messaging block.
Definition: agents.h:10965
void _Invoke_handler(message< _Type > *_Msg)
Definition: agents.h:2349
_TargetLinkRegistry::iterator target_iterator
The iterator to walk the connected targets.
Definition: agents.h:3242
size_t _M_index
Definition: agents.h:421
_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:1353
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:9996
The multi_link_registry object is a network_link_registry that manages multiple source blocks or mult...
Definition: agents.h:908
void _To_array(::Concurrency::details::_Dynamic_array< _EType > &_Array)
Definition: agents.h:1708
_EType const * const_pointer
Definition: agents.h:1255
volatile long _M_referenceCount
Definition: agents.h:12974
propagator_block()
Constructs a propagator_block object.
Definition: agents.h:3952
unbounded_buffer()
Constructs an unbounded_buffer messaging block.
Definition: agents.h:4280
This class describes an exception thrown when an invalid operation is performed that is not more accu...
Definition: concrt.h:1705
_Block * _EType
A type that represents a pointer to an element stored in the source_link_manager object.
Definition: agents.h:1444
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:6826
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:9949
_EType _M_sentinel
Definition: agents.h:1397
reference operator[](size_t _Pos)
Definition: agents.h:335
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:7301
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:8440
void _Propagate_message()
Definition: agents.h:3868
ScheduleGroup * _M_pScheduleGroup
Definition: agents.h:10123
std::tr1::function< void(void)> _Propagator_method
The signature of the callback method invoked while propagating messages.
Definition: agents.h:2021
_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:9360
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
ISource< _Type > * _M_pReservedSource
Definition: agents.h:9655
_Message ** _M_ppTail
Definition: agents.h:112
_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:8568
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:3689
choice(choice &&_Choice)
Constructs a choice messaging block.
Definition: agents.h:9811
~_MessageArray()
Definition: agents.h:8218
_MessageArray _M_messageArray
Definition: agents.h:8225
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:169
virtual bool reserve_message(runtime_object_identity _MsgId)
Reserves a message previously offered by this join messaging block.
Definition: agents.h:7800
virtual void _Reset()=0
Resets the _Order_node_base and prepares it for the next propagation
_Type _M_sourceTuple
Definition: agents.h:10811
Scheduler * _M_pScheduler
Definition: agents.h:10120
_Source_link_iterator< _LinkRegistry > _Myt
Definition: agents.h:1247
virtual void release_message(runtime_object_identity _MsgId)
Releases a previous message reservation.
Definition: agents.h:5278
void _Process_message(message< _Target_type > *_PMessage)
Definition: agents.h:3859
agent const & operator=(agent const &)
_CRTIMP size_t wait(unsigned int _Timeout=COOPERATIVE_TIMEOUT_INFINITE)
Waits for the event to become signaled.
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:9508
const_pointer operator->() const
Returns a pointer to the class object
Definition: agents.h:1332
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:7178
bool _Is_head(runtime_object_identity _MsgId)
Definition: agents.h:232
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:10612
void _Wait_for_completion()
Definition: agents.h:12932
virtual message< _Target_type > * consume_message(runtime_object_identity _MsgId)=0
When overridden in a derived class, consumes a message that was previously reserved.
virtual bool reserve_message(runtime_object_identity _MsgId)
Reserves a message previously offered by this overwrite_buffer messaging block.
Definition: agents.h:5210
event _M_ev
Definition: agents.h:12963
static _CRTIMP void __cdecl _ScheduleTask(TaskProc _Proc, void *_Data)
::Concurrency::runtime_object_identity _M_id
Definition: agents.h:100
_Myt operator++(int)
Post-increment the iterator to point to the next element
Definition: agents.h:1366
static bool _send(ITarget< _Type > *_Trg, const _Type &_Data)
Definition: agents.h:13278
~_Non_greedy_node()
Cleans up any resources that may have been created by the _Order_node.
Definition: agents.h:9427
State _M_state
Definition: agents.h:6781
source_link_manager< _SourceLinkRegistry > _SourceLinkManager
The type of the source_link_manager this target_block object.
Definition: agents.h:2810
An event type that represents the linking of message blocks
Definition: concrt.h:5825
Non-greedy join messaging blocks postpone messages and try and consume them after all have arrived...
Definition: agents.h:7439
_Propagator_method _M_propagator
A message propagating object which exposes the callback to be invoked
Definition: agents.h:2433
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:9632
join(size_t _NumInputs)
Constructs a join messaging block.
Definition: agents.h:7482
An event type that represents the unlinking of message blocks
Definition: concrt.h:5831
virtual void release(runtime_object_identity _MsgId, _Inout_ ITarget< _Destination_type > *_PTarget)
Releases a previous successful message reservation.
Definition: agents.h:11112
virtual void link_source(_Inout_ ISource< _Source_type > *_PSource)
Links a specified source block to this propagator_block object.
Definition: agents.h:4110
virtual void process_input_messages(_Inout_ message< _Source_type > *_PMessage)
Processes messages that are received as inputs.
Definition: agents.h:3175
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:3769
_SourceLinkRegistry::type::source_type _Source_type
The type of the payload for the incoming message to this propagator_block.
Definition: agents.h:3934
_CRTIMP unsigned int _Release()
The basic message envelope containing the data payload being passed between messaging blocks...
Definition: agents.h:1775
Implements busy wait with no backoff
Definition: concrt.h:604
void release()
Releases the reference on the source_link_manager object.
Definition: agents.h:1627
_EType const * const_pointer
A type that provides a pointer to a const element in a network_link_registry object.
Definition: agents.h:623
const_reference operator*()
Returns the object pointed to by the iterator
Definition: agents.h:521
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
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:5170
size_t _M_maxLinks
Definition: agents.h:1224
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:11484
virtual void unlink_target(_Inout_ ITarget< size_t > *_PTarget)
Unlinks a target block from this choice messaging block.
Definition: agents.h:9918
void async_send(_Inout_opt_ message< _Source_type > *_PMessage)
Asynchronously sends a message for processing.
Definition: agents.h:3124
Definition: concrt.h:4253
runtime_object_identity _M_savedId
Definition: agents.h:8855
size_t _M_count
Definition: agents.h:115
virtual ~target_block()
Destroys the target_block object.
Definition: agents.h:2833
void _Delete_joins()
Deletes all _Order_node elements that were created in _Initialize_joins.
Definition: agents.h:11218
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:7239
_FS_DLL int __CLRCALL_PURE_OR_CDECL _Link(const char *, const char *)
~_Reserving_node()
Cleans up any resources that may have been created by the _Reserving_node.
Definition: agents.h:8663
Definition: agents.h:12692
void _Clear_queued_messages()
Definition: agents.h:2233
virtual void release_ref(_Inout_ ITarget< _Target_type > *_PTarget)
Releases a reference count on this source_block object.
Definition: agents.h:3557
multi_link_registry()
Constructs a multi_link_registry object.
Definition: agents.h:916
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:13399
size_t count()
Counts the number of linked blocks in the source_link_manager object.
Definition: agents.h:1682
const_reference _Get(size_t _Pos) const
Definition: agents.h:1376
The ITarget class is the interface for all target blocks. Target blocks consume messages offered to t...
Definition: agents.h:452
void _Handle_message(message< _Target_type > *_PMessage)
Private methods.
Definition: agents.h:3849
::Concurrency::details::_Queue< message< _Destination_type > > _M_messageBuffer
Definition: agents.h:10819
The agent has been started, but not entered its run method.
Definition: agents.h:11510
virtual bool supports_anonymous_source()
Overrides the supports_anonymous_source method to indicate that this block can accept messages offere...
Definition: agents.h:5149
This class describes an exception thrown when a messaging block is given a pointer to a target which ...
Definition: concrt.h:1543
void(__cdecl * TaskProc)(void *)
Concurrency::details contains definitions of support routines in the public namespaces and one or mor...
Definition: concrt.h:265
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:7114
void decline_incoming_messages()
Indicates to the block that new messages should be declined.
Definition: agents.h:3069
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:6708
_Type type
A type alias for _Type .
Definition: agents.h:1936
bool _internal_send(ITarget< _Type > *_PTarget, _Type const &_Value)
Definition: agents.h:12873
concurrent_queue< message< _Type > * > _M_queuedMessages
A queue of the messages
Definition: agents.h:2377
static _CRTIMP2 agent_status __cdecl wait(_Inout_ agent *_PAgent, unsigned int _Timeout=COOPERATIVE_TIMEOUT_INFINITE)
Waits for an agent to complete its task.
An event type that represents the creation of an object
Definition: concrt.h:5795
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:2736
_LinkRegistry::type _Block
The type of the blocks being managed by the source_link_manager object.
Definition: agents.h:1432
__int64 _Trace_agents_get_id(_Type *_PObject)
Definition: agents.h:434
_Type type
A type alias for _Type .
Definition: agents.h:1901
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:2529
~join()
Destroys the join block.
Definition: agents.h:7636
virtual void link_target(_Inout_ ITarget< _Destination_type > *_PTarget)
Links a target block to this multitype_join messaging block.
Definition: agents.h:11011
void _Delete_stored_messages()
Deletes all messages currently stored in this message block. Should be called by the destructor to en...
Definition: agents.h:6861
_Join_node const & operator=(_Join_node const &)
_Greedy_node const & operator=(_Greedy_node const &)
bool _M_fForceRepropagation
A bool to signal to the processor to force a repropagation to occur
Definition: agents.h:4835
Scheduler * _M_pScheduler
Definition: agents.h:11774
_TargetLinkRegistry _M_connectedTargets
Connected targets
Definition: agents.h:3833
~_Order_node_base()
Cleans up any resources that may have been created by the _Order_node.
Definition: agents.h:8298
void _Initialize_choices()
Constructs and initializes a _Reserving_node for each tuple messaging block passed in...
Definition: agents.h:10056
runtime_object_identity _M_savedId
Definition: agents.h:9661
The source_block class is an abstract base class for source-only blocks. The class provides basic lin...
Definition: agents.h:3228
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:2409
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:3365
_TargetLinkRegistry::type::type _Target_type
The payload type of messages handled by this source_block.
Definition: agents.h:3236
_Dynamic_array()
Definition: agents.h:266
_Network_link_iterator< _Block > _Myt
Definition: agents.h:474
void _Done(message_status _Status)
Definition: agents.h:12950
virtual bool reserve(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:12796
virtual bool contains(_EType _Link)
Searches the single_link_registry object for a specified block.
Definition: agents.h:821
single_link_registry< ITarget< _Type > > _Target_registry
Definition: agents.h:12539
_Myt & operator++()
Pre-increment the iterator to point to the next element
Definition: agents.h:547
_CRTIMP unsigned int _Reference()
single_assignment(filter_method const &_Filter)
Constructs a single_assignment messaging block.
Definition: agents.h:6942
_LinkRegistry _M_links
Definition: agents.h:1729
bool contains(_EType _Link)
Searches the network_link_registry within this source_link_manager object for a specified block...
Definition: agents.h:1669
void _Push_back(_Type const &_Element)
Definition: agents.h:318
typedef void(__cdecl *_se_translator_function)(unsigned int
message(_Type const &_P, runtime_object_identity _Id)
Constructs a message object.
Definition: agents.h:1809
_Type * _M_array
Definition: agents.h:418
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:1750
message< _Type > * _M_pMessage
Definition: agents.h:5407
message(_Type const &_P)
Constructs a message object.
Definition: agents.h:1792
_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:9332
size_t _M_index
Definition: agents.h:1394
choice(_Type _Tuple)
Constructs a choice messaging block.
Definition: agents.h:9723
overwrite_buffer< agent_status > _M_status
Holds the current status of the agent.
Definition: agents.h:11753
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:11097
virtual void unlink_source(_Inout_ ISource< _Source_type > *_PSource)
Unlinks a specified source block from this propagator_block object.
Definition: agents.h:4125
The target postponed the message.
Definition: agents.h:1755
The Concurrency namespace provides classes and functions that provide access to the Concurrency Runti...
Definition: agents.h:42
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:7770
virtual void release(runtime_object_identity _MsgId, _Inout_ ITarget< size_t > *_PTarget)
Releases a previous successful message reservation.
Definition: agents.h:10011
void _Reset()
Resets the _Greedy_node and prepares it for the next propagation
Definition: agents.h:9055
_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:616
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:9466
Helper class used in multi-type greedy join blocks Ordered node is a single-target, single-source ordered propagator block
Definition: agents.h:8879
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:5449
virtual ~source_block()
Destroys the source_block object.
Definition: agents.h:3262
::Concurrency::details::_ReentrantPPLLock _M_resetLock
Definition: agents.h:9239
virtual bool supports_anonymous_source()
Overrides the supports_anonymous_source method to indicate that this block can accept messages offere...
Definition: agents.h:5739
_SourceLinkManager::iterator source_iterator
The type of the iterator for the source_link_manager for this target_block object.
Definition: agents.h:2816
single_link_registry()
Constructs a single_link_registry object.
Definition: agents.h:741
volatile long _M_counter
Definition: agents.h:10816
Helper class used in multi-type choice blocks Ordered node is a single-target, single-source ordered ...
Definition: agents.h:8500
join_type
The type of a join messaging block.
Definition: agents.h:7427
virtual void release(runtime_object_identity _MsgId, _Inout_ ITarget< _Type > *_PTarget)=0
When overridden in a derived class, releases a previous successful message reservation.
virtual iterator begin()
Returns an iterator to the first element in the single_link_registry object.
Definition: agents.h:848
Scheduler * _M_pScheduler
Definition: agents.h:11244
virtual void release_ref(_Inout_ ITarget< size_t > *_PTarget)
Releases a reference count on this choice messaging block.
Definition: agents.h:10043
_Type _M_sourceTuple
Definition: agents.h:10117
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:7880
Definition: agents.h:10256
virtual void link_source(_Inout_ ISource< _Source_type > *_PSource)
Links a specified source block to this target_block object.
Definition: agents.h:2991
The timer has been initialized, but not yet started.
Definition: agents.h:6443
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:11128
An ordered_message_processor is a message_processor that allows message blocks to process messages in...
Definition: agents.h:2008
_LockType _M_lock
Definition: agents.h:1720
_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:8650
#define _Out_writes_opt_(size)
Definition: sal.h:355
_Payload_type const & value()
Gets the message whose index was selected by the choice messaging block.
Definition: agents.h:9890
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:11368
virtual ~single_link_registry()
Destroys the single_link_registry object.
Definition: agents.h:753
const_pointer operator->() const
Returns a pointer to the class object
Definition: agents.h:534
void enable_batched_processing()
Enables batched processing for this block.
Definition: agents.h:3106
#define NULL
Definition: crtdbg.h:30
_Type _M_sourceTuple
Definition: agents.h:11241
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:50
_CRTIMP Concurrency::Scheduler * _GetScheduler()
Definition: concrt.h:396
Helper class used in multi-type non-greedy join blocks Ordered node is a single-target, single-source ordered propagator block
Definition: agents.h:9264
void _Invoke_link_source(ITarget< _Type > *_PLinkFrom)
Links this source to a target.
Definition: agents.h:2753
void pause()
Stops the timer messaging block. If it is a repeating timer messaging block, it can be restarted with...
Definition: agents.h:6619
size_t _Size() const
Definition: agents.h:353
bool _Remove(_EType _Link)
Removes a link from the multi_link_registry
Definition: agents.h:1150
virtual void release(runtime_object_identity _MsgId, _Inout_ ITarget< _Target_type > *_PTarget)
Releases a previous successful message reservation.
Definition: agents.h:3506
virtual message< _Type > * accept(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:12566
::Concurrency::details::_Dynamic_array< _EType > _M_vector
Definition: agents.h:1227
~_Join_node()
Cleans up any resources that may have been created by the join.
Definition: agents.h:10327
_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:8972
An event type that represents the name for an object
Definition: concrt.h:5837
virtual _CRTIMP2 ~agent()
Destroys the agent.
message< _Type > * _M_pReceiveMessage
Definition: agents.h:8473
virtual void release_ref(_Inout_ ITarget< _Type > *)
When overridden in a derived class, releases a reference count on this ISource block.
Definition: agents.h:12614
volatile bool _M_fIsInitialized
Definition: agents.h:9667
A timer messaging block is a single-target source_block capable of sending a message to its target af...
Definition: agents.h:6429
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:1056
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:4515
size_t _M_size
Definition: agents.h:424
The agent finished without being canceled.
Definition: agents.h:11520
_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:8542
void _Wait_on_ref()
Definition: agents.h:12940
size_t index()
Returns an index into the tuple representing the element selected by the choice messaging block...
Definition: agents.h:9869
_Type & reference
Definition: agents.h:260
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:4155
size_t _Count() const
Definition: agents.h:131
message< std::vector< _Type > > *__cdecl _Create_new_message()
Constructs a new message from the data output.
Definition: agents.h:8043
virtual bool reserve(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:12590
bool has_value() const
Checks whether this single_assignment messaging block has been initialized with a value yet...
Definition: agents.h:7069
The single_link_registry object is a network_link_registry that manages only a single source or targe...
Definition: agents.h:733
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:7820
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:10244
The timer has started and been paused.
Definition: agents.h:6453
A multitype_join messaging block is a multi-source, single-target messaging block that combines toget...
Definition: agents.h:10851
void _Delete_stored_messages()
Deletes all messages currently stored in this message block. Should be called by the destructor to en...
Definition: agents.h:7386
virtual _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:882
runtime_object_identity * _M_savedIds
Definition: agents.h:8236
virtual bool reserve_message(runtime_object_identity _MsgId)
Reserves a message previously offered by this single_assignment messaging block.
Definition: agents.h:7272
void _Populate_destination_tuple(_Destination_type &_Destination_tuple, ISource< size_t > **_Sources)
Copies payloads from all sources to destination tuple.
Definition: agents.h:10790
choice const & operator=(choice const &)
An unbounded_buffer messaging block is a multi-target, multi-source, ordered propagator_block capable...
Definition: agents.h:4264
void _Clear()
Definition: agents.h:306
bool _SpinOnce()
Spins for one time quantum,until a maximum spin is reached.
Definition: concrt.h:652
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:1929
bool _Release_received_message()
Called for a non_greedy type join block release a reservation on this block
Definition: agents.h:9530
overwrite_buffer const & operator=(overwrite_buffer const &)
unbounded_buffer(filter_method const &_Filter)
Constructs an unbounded_buffer messaging block.
Definition: agents.h:4303
multitype_join(_Type _Tuple)
Constructs a multitype_join messaging block.
Definition: agents.h:10877
_Queue()
Definition: agents.h:121
size_t _M_count
Definition: agents.h:8235
_Block * _EType
Definition: agents.h:478
_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:1467
timer const & operator=(timer const &)
#define _InterlockedDecrementSizeT(_Target)
Definition: concrt.h:111
virtual ~ordered_message_processor()
Destroys the ordered_message_processor object.
Definition: agents.h:2056
static const size_t _NOT_SET
Definition: agents.h:1221
overwrite_buffer(filter_method const &_Filter)
Constructs an overwrite_buffer messaging block.
Definition: agents.h:4903
bool _internal_asend(ITarget< _Type > *_PTarget, _Type const &_Value)
Definition: agents.h:12648
virtual void resume_propagation()
Resumes propagation after a reservation has been released
Definition: agents.h:10469
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:7862
message< _Type > * _M_pMessage
Definition: agents.h:12684
virtual message< _Type > * accept(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:12762
virtual message< _Type > * accept(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:13058
The timer has been started.
Definition: agents.h:6448
_Target_registry _M_connectedTargets
Definition: agents.h:13267
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:5333
static void __cdecl _Agent_task_wrapper(void *data)
_In_ _CRT_GUARDOVERFLOW size_t _NewSize
Definition: malloc.h:108
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:4243
virtual bool reserve_message(runtime_object_identity _MsgId)
Reserves a message previously offered by the source.
Definition: agents.h:10423
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:70
_Join_node(Scheduler &_PScheduler)
Constructs a join within the specified scheduler, and places it on any schedule group of the schedule...
Definition: agents.h:10305
::Concurrency::details::_NonReentrantPPLLock _M_asyncSendLock
A lock to use for queueing incoming messages.
Definition: agents.h:2383
ScheduleGroup * _M_pScheduleGroup
Definition: agents.h:11775
virtual void link_source(_Inout_ ISource< _Type > *_PSource)=0
When overridden in a derived class, links a specified source block to this ITarget block...
_CRTIMP2 agent()
Constructs an agent.
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:5707
_Type dequeue()
Removes an item from the unbounded_buffer messaging block.
Definition: agents.h:4450
virtual void resume_propagation()
Resumes propagation after a reservation has been released.
Definition: agents.h:5299
virtual ~multi_link_registry()
Destroys the multi_link_registry object.
Definition: agents.h:928
_CRTIMP void set()
Signals the event.
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:3987
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:10501
volatile bool _M_fIsInitialized
Definition: agents.h:8858
_Type const & const_reference
Definition: agents.h:261
A class intended to be used as a base class for all independent agents. It is used to hide state from...
Definition: agents.h:11536
_LockType::_Scoped_lock _LockHolder
A type that provides a RAII scoped lock holder for a lock.
Definition: agents.h:1479
An event type that represents the conclusion of some processing
Definition: concrt.h:5807
_MessageArray(size_t _NumInputs)
Definition: agents.h:8211
virtual void add(_EType _Link)=0
When overridden in a derived class, adds a link to the network_link_registry object.
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
#define _In_z_
Definition: sal.h:319
message_status
The valid responses for an offer of a message object to a block.
Definition: agents.h:1739
_CRTIMP2 _Runtime_object()
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:6748
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:13342
#define _In_
Definition: sal.h:314
virtual ~_Source_link_iterator()
Destruct iterator
Definition: agents.h:1271
runtime_object_identity msg_id() const
Returns the ID of the message object.
Definition: agents.h:1860
virtual void _Reset()
Resets the _Reserving_node and prepares it for the next propagation
Definition: agents.h:8683
_CRTIMP2 ISource< agent_status > * status_port()
An asynchronous source of status information from the agent.
volatile long _M_refCount
Definition: agents.h:1912
void _Invoke_unlink_source(ITarget< _Type > *_PUnlinkFrom)
Unlinks this source from a target.
Definition: agents.h:2772
_CRTIMP2 bool start()
Moves an agent from the agent_created state to the agent_runnable state, and schedules it for executi...
_Call_method _M_pFunc
Definition: agents.h:5775
virtual void link_target(_Inout_ ITarget< size_t > *_PTarget)
Links a target block to this choice messaging block.
Definition: agents.h:9906
#define _Inout_opt_
Definition: sal.h:385
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:203
message< _Type > * _M_pMessage
Definition: agents.h:7403
This class describes an exception thrown when an operation has timed out.
Definition: concrt.h:1762
Definition: concrt.h:4216
message(_In_ message const *_Msg)
Constructs a message object.
Definition: agents.h:1839
_SourceLinkRegistry::type::source_type _Source_type
The type of the payload for the incoming messages to this target_block object.
Definition: agents.h:2804
_Join_node(ScheduleGroup &_PScheduleGroup)
Constructs a join within the specified schedule group. The scheduler is implied by the schedule group...
Definition: agents.h:10318
const_reference operator[](size_t _Pos) const
Index operation. Retrieve an element at the specified index.
Definition: agents.h:1341
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:8713
::Concurrency::details::_Queue< message< std::vector< _Type > > > _M_messageBuffer
Definition: agents.h:8259
runtime_object_identity _M_reservedId
Definition: agents.h:9664
virtual message< _Type > * consume(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:12596
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:7359
virtual void unlink_targets()
When overridden in a derived class, unlinks all target blocks from this ISource block.
Definition: agents.h:13023
Definition: agents.h:13272
overwrite_buffer()
Constructs an overwrite_buffer messaging block.
Definition: agents.h:4881
An overwrite_buffer messaging block is a multi-target, multi-source, ordered propagator_block capable...
Definition: agents.h:4865
Definition: agents.h:8206
The target_block class is an abstract base class that provides basic link management functionality an...
Definition: agents.h:2796
void start()
Starts the timer messaging block. The specified number of milliseconds after this is called...
Definition: agents.h:6593
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:13163
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:3590
bool remove(_EType _Link)
Removes a link from the source_link_manager object.
Definition: agents.h:1568
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:12609
virtual void resume_propagation()
Resumes propagation after a reservation has been released.
Definition: agents.h:7329
::Concurrency::details::_Dynamic_array< _EType > _M_array
Definition: agents.h:1388
virtual message< _Type > * consume(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:12818
virtual void unlink_target(_Inout_ ITarget< _Destination_type > *_PTarget)
Unlinks a target block from this multitype_join messaging block.
Definition: agents.h:11023
virtual void resume_propagation()
Resumes propagation after a reservation has been released.
Definition: agents.h:4631
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:10855
virtual void link_target_notification(_Inout_ ITarget< _Destination_type > *)
Notification that a target was linked to this source.
Definition: agents.h:10485
~choice()
Destroys the choice messaging block.
Definition: agents.h:9834
_Type value()
Gets a reference to the current payload of the message being stored in the overwrite_buffer messaging...
Definition: agents.h:5048
bool _M_fRepeating
Definition: agents.h:6787
_Block * _EType
A type that represents an element pointer stored in the network_link_registry object.
Definition: agents.h:609
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:3197
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:1457
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:2390
::Concurrency::details::_ReentrantPPLLock _M_internalLock
Definition: agents.h:12969
virtual void _Fire()
Called when the timer fires.
Definition: agents.h:6808
virtual message< _Type > * consume(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:13109
void wait_for_async_sends()
Waits for all asynchronous propagations to complete.
Definition: agents.h:3149
virtual size_t count()
Counts the number of items in the multi_link_registry object.
Definition: agents.h:1026
virtual bool contains(_EType _Link)
Searches the multi_link_registry object for a specified block.
Definition: agents.h:1009
::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:64
static _CRTIMP2 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.
_SavedMessageIdArray(size_t _NumInputs)
Definition: agents.h:8238
volatile long _M_iteratorCount
Definition: agents.h:1723
std::vector< _Type > _OutputType
Definition: agents.h:7464
_Type type
A type alias for _Type .
Definition: agents.h:2538
This class describes an exception thrown when a messaging block is unable to find a requested message...
Definition: concrt.h:1567
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...
static _CRTIMP void __cdecl _Yield()
virtual void acquire_ref(_Inout_ ITarget< size_t > *_PTarget)
Acquires a reference count on this choice messaging block, to prevent deletion.
Definition: agents.h:10027
virtual void unlink_targets()
Unlinks all targets from this choice messaging block.
Definition: agents.h:9931
void * _M_pSourceChoices[std::tr1::tuple_size< _Type >::value]
Definition: agents.h:10111
long remove_ref()
Subtracts from the reference count for the message object. Used for message blocks that need referenc...
Definition: agents.h:1892
Definition: concrt.h:5489
~call()
Destroys the call messaging block.
Definition: agents.h:5638
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:3606
_Type type
A type alias for _Type .
Definition: agents.h:10998
void remove_sources()
Unlinks all sources after waiting for outstanding asynchronous send operations to complete...
Definition: agents.h:3164
_Type const payload
The payload of the message object.
Definition: agents.h:1869
_In_reads_(_N) const wchar_t *_S2
The target tried to accept the message, but it was no longer available.
Definition: agents.h:1760
void _Initialize_joins()
Constructs and initializes a _Order_node for each tuple messaging block passed in.
Definition: agents.h:11159
source_link_manager()
Constructs a source_link_manager object.
Definition: agents.h:1485
::Concurrency::details::_ReentrantPPLLock _M_internalLock
Definition: agents.h:13264
message< _Type > ** _M_messages
Definition: agents.h:8209
The target accepted the message.
Definition: agents.h:1745
message< _Type > * _M_pMessage
Definition: agents.h:12960
::Concurrency::details::_ReentrantPPLLock _LockType
A type that provides a reentrant lock for the source_link_manager object.
Definition: agents.h:1473
virtual void add(_EType _Link)
Adds a link to the multi_link_registry object.
Definition: agents.h:969
void enable_batched_processing()
Enables batched processing for this block.
Definition: agents.h:3745
_SyncOriginator()
Definition: agents.h:12699
volatile long _M_fCancelable
Definition: agents.h:11768
_EType const & const_reference
Definition: agents.h:1254
An event type that represents the scheduling of a process
Definition: concrt.h:5819
_Type const & value()
Gets a reference to the current payload of the message being stored.
Definition: agents.h:8325
::Concurrency::details::_ReentrantPPLLock _M_internalLock
Internal lock used for the following synchronization:
Definition: agents.h:3895
::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:57
_Myt const & operator=(_Myt const &_Right)
Copy assign an iterator
Definition: agents.h:1295
_Source_link_iterator(_MyContainer *_PNetwork_link, size_t _Index)
Construct iterator
Definition: agents.h:1261
void * _M_pSourceJoins[std::tr1::tuple_size< _Type >::value]
Definition: agents.h:11235
volatile long _M_refcount
Definition: agents.h:13261
ScheduleGroup * _M_pScheduleGroup
Definition: agents.h:11247
virtual void acquire_ref(_Inout_ ITarget< _Target_type > *)
Acquires a reference count on this source_block object, to prevent deletion.
Definition: agents.h:3541
A join messaging block is a single-target, multi-source, ordered propagator_block which combines toge...
Definition: agents.h:7461
void _Sync_send_helper(message< _Type > *_Msg)
Definition: agents.h:2242
virtual ~_SyncOriginator()
Definition: agents.h:12707
virtual void link_target(ITarget< _Type > *_PTarget)
Definition: agents.h:12916
The network_link_registry abstract base class manages the links between source and target blocks...
Definition: agents.h:459
message< _Type > * _M_pReservedMessage
Definition: agents.h:5410
void _Delete_stored_messages()
Deletes all messages currently stored in this message block. Should be called by the destructor to en...
Definition: agents.h:10771
The ISource class is the interface for all source blocks. Source blocks propagate messages to ITarget...
Definition: agents.h:451
_MessageProcessorType _M_messageProcessor
The message_processor for this target_block.
Definition: agents.h:3203
virtual void resume_propagation()
Resumes propagation after a reservation has been released.
Definition: agents.h:6735
_Type type
A type alias for _Type .
Definition: agents.h:2027
_SourceLinkManager _M_connectedSources
The container for all the sources connected to this block.
Definition: agents.h:4230
bool has_value() const
Checks whether this choice messaging block has been initialized with a value yet. ...
Definition: agents.h:9853
void add(_EType _Link)
Adds a source link to the source_link_manager object.
Definition: agents.h:1530
single_link_registry< ITarget< _Type > > _Target_registry
Definition: agents.h:12696
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:4477
Definition: agents.h:8233
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:8378
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:8797
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:3087
#define false
Definition: stdbool.h:11
_EType _M_connectedLink
Definition: agents.h:895
_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:8997
_Non_greedy_node const & operator=(_Non_greedy_node const &)
virtual size_t _Find(_EType _Link)
Searches the registry for the given link
Definition: agents.h:1185
virtual void unlink_target(ITarget< _Type > *_PTarget)
Definition: agents.h:12553
static _CRTIMP _Scheduler __cdecl _Get()
virtual void unlink_sources()
Unlinks all source blocks from this propagator_block object.
Definition: agents.h:4138
bool enqueue(_Type const &_Item)
Adds an item to the unbounded_buffer messaging block.
Definition: agents.h:4438
virtual void unlink_targets()
Unlinks all target blocks from this source_block object.
Definition: agents.h:3327
void * _InterlockedCompareExchangePointer(void *volatile *, void *, void *)
const unsigned int COOPERATIVE_TIMEOUT_INFINITE
Value indicating that a wait should never time out.
Definition: concrt.h:3538
virtual bool reserve_message(runtime_object_identity _MsgId)
Reserves a message previously offered by this unbounded_buffer messaging block.
Definition: agents.h:4585
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:10393
ScheduleGroup * _M_pScheduleGroup
The schedule group to process messages on
Definition: agents.h:2402
virtual void link_target(_Inout_ ITarget< _Target_type > *_PTarget)
Links a target block to this source_block object.
Definition: agents.h:3281
std::tr1::function< void(_Block *, bool)> _Callback_method
The method signature for a callback method for this source_link_manager object.
Definition: agents.h:1438
bool _M_fReferencedScheduler
Definition: agents.h:6790
_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:8945
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:12858
virtual _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:1081
message_status _Propagate_to_target(ITarget< size_t > *_PTarget)
Propagate messages to the given target
Definition: agents.h:8817
long _Process_message_helper()
Definition: agents.h:2272
void initialize_source(_Inout_opt_ Scheduler *_PScheduler=NULL, _Inout_opt_ ScheduleGroup *_PScheduleGroup=NULL)
Initializes the message_propagator within this source_block.
Definition: agents.h:3731
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:1518
Definition: agents.h:12979
bool has_value() const
Checks whether this block has been initialized yet.
Definition: agents.h:8313
_Type const & value()
Gets a reference to the current payload of the message being stored in the single_assignment messagin...
Definition: agents.h:7085
An event type that represents the initiation of some processing
Definition: concrt.h:5801
An event type that represents the deletion of an object
Definition: concrt.h:5813
message< size_t > * _M_pSendMessage
Definition: agents.h:8476
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:13446
static _CRTIMP2 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.
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:4654
~unbounded_buffer()
Destroys the unbounded_buffer messaging block.
Definition: agents.h:4419
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:2126
virtual void release_ref(_Inout_ ITarget< _Type > *)
When overridden in a derived class, releases a reference count on this ISource block.
Definition: agents.h:12863
::Concurrency::details::_NonReentrantPPLLock _M_propagationLock
Definition: agents.h:9236
agent_status
The valid states for an agent.
Definition: agents.h:11500
bool _internal_send(ITarget< _Type > *_PTarget, _Type const &_Value)
Definition: agents.h:13186
_Join_node< _Type, _Destination_type, _Jtype > * _M_pJoinNode
Definition: agents.h:11238
unbounded_buffer const & operator=(unbounded_buffer const &)
virtual void unlink_targets()
Unlinks all targets from this multitype_join messaging block.
Definition: agents.h:11032
_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:9414
source_link_manager< _LinkRegistry > _MyContainer
Definition: agents.h:1248
volatile size_t _M_messagesRemaining
Definition: agents.h:8202
_Type _M_value
Definition: agents.h:6784
_In_ wctype_t _Type
Definition: ctype.h:205
~_Dynamic_array()
Definition: agents.h:274
_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:9306
bool _Remove(_Message *_OldElement)
Definition: agents.h:155
void _Propagate_priority_order(::Concurrency::details::_Queue< message< _Target_type >> &_MessageBuffer)
Propagates messages in priority order.
Definition: agents.h:4747
virtual void link_target_notification(_Inout_ ITarget< size_t > *)
Notification that a target was linked to this source.
Definition: agents.h:8419
_CRTIMP2 agent_status status()
A synchronous source of status information from the agent.
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:863
void _Acquire_ref()
Definition: agents.h:13241
void _Create_send_message()
Create a message that contains an index used to determine the source message
Definition: agents.h:8431
virtual void initialize_batched_processing(_Handler_method const &_Processor, _Propagator_method const &_Propagator)
Initialize batched message processing
Definition: agents.h:2094
virtual ::Concurrency::runtime_object_identity _GetId() const
Definition: agents.h:93
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:9134
virtual bool remove(_EType _Link)
Removes a link from the single_link_registry object.
Definition: agents.h:800
_Target_registry _M_connectedTargets
Definition: agents.h:12972
message * _M_pNext
Definition: agents.h:1906
void register_filter(filter_method const &_Filter)
Registers a filter method that will be invoked on every message received.
Definition: agents.h:3054
A single_assignment messaging block is a multi-target, multi-source, ordered propagator_block capable...
Definition: agents.h:6903
virtual void unlink_target(ITarget< _Type > *_PTarget)
Definition: agents.h:12717
std::tr1::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:2545
bool _internal_send(ITarget< _Type > *_PTarget, _Type const &_Value)
Definition: agents.h:12623
_Handler_method _M_handler
A message handler object which exposes the callback to be invoked
Definition: agents.h:2421
network_link_registry< _Block > _MyContainer
Definition: agents.h:475
_SourceLinkManager _M_connectedSources
The container for all the sources connected to this block.
Definition: agents.h:3184
virtual void release(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:13141
State
Tracks the state machine of the timer.
Definition: agents.h:6437
size_t _Count() const
Returns the count of items in the registry.
Definition: agents.h:1206
Base class for Helper node used in multi-type join and choice blocks Order node is a single-target...
Definition: agents.h:8278
_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:9281
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:3794
size_t _M_index
Definition: agents.h:8479
void _Invoke_handler(long _Count)
Definition: agents.h:2319
size_t _M_index
Definition: agents.h:575
_Type type
A type alias for _Type .
Definition: agents.h:9844
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:11050
_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:1451
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:6793
virtual void unlink_targets()
When overridden in a derived class, unlinks all target blocks from this ISource block.
Definition: agents.h:12738
_EType const * const_pointer
Definition: agents.h:482
_SourceLinkManager::iterator source_iterator
The type of the iterator for the source_link_manager for this propagator_block.
Definition: agents.h:3946
~source_link_manager()
Destroys the source_link_manager object.
Definition: agents.h:1493
runtime_object_identity * _M_savedIdBuffer
Definition: agents.h:8253
runtime_object_identity _M_reservedId
Reserved message ID
Definition: agents.h:3827
_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:12068
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:4605
#define _CRTIMP2
Definition: crtdefs.h:126
virtual void link_target(ITarget< _Type > *_PTarget)
Definition: agents.h:12678
ITarget< _Type > * _M_pTarget
Definition: agents.h:12687
size_t _M_count
Definition: agents.h:8208
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:10719
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:5664
_Myt operator++(int)
Post-increment the iterator to point to the next element
Definition: agents.h:562
message< _Type > * _NewMessage() const
Allocates a new message.
Definition: agents.h:6799
virtual void release_message(runtime_object_identity _MsgId)
Releases a previous message reservation.
Definition: agents.h:7833
virtual void link_target(ITarget< _Type > *_PTarget)
Definition: agents.h:13223
void _Initialize(size_t _NumInputs, Scheduler *_PScheduler=NULL, ScheduleGroup *_PScheduleGroup=NULL)
Initializes the join messaging block.
Definition: agents.h:8156
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:2077
virtual void release_ref(_Inout_ ITarget< _Type > *)
When overridden in a derived class, releases a reference count on this ISource block.
Definition: agents.h:13168
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:6762
_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:8622
volatile message_status _M_fStatus
Definition: agents.h:12966
virtual void release(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:12836
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:4173
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:9699
_CRTIMP2 bool cancel()
Moves an agent from either the agent_created or agent_runnable states to the agent_canceled state...
void _Add(_EType _Link)
Adds a link to the multi_link_registry object.
Definition: agents.h:1100
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:9579
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:6653
void _Wait_on_ref(long _RefCount=0)
Definition: agents.h:3877
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:8182
filter_method * _M_pFilter
The filter function which determines whether offered messages should be accepted. ...
Definition: agents.h:4236
~overwrite_buffer()
Destroys the overwrite_buffer messaging block.
Definition: agents.h:5016
_LinkRegistry type
The type of link registry being managed by the source_link_manager object.
Definition: agents.h:1426
virtual void process_input_messages(_Inout_ message< _Type > *_PMessage)
Executes the call function on the input messages.
Definition: agents.h:5760
~_SavedMessageIdArray()
Definition: agents.h:8245
static bool _asend(ITarget< _Type > *_Trg, const _Type &_Data)
Definition: agents.h:13299
virtual iterator begin()
Returns an iterator to the first element in the multi_link_registry object.
Definition: agents.h:1041
virtual bool reserve(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:13087
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:9208
virtual void release_message(runtime_object_identity)
Releases a previous message reservation.
Definition: agents.h:8393
_MyContainer * _M_pNetwork_link
Definition: agents.h:1391
single_assignment const & operator=(single_assignment const &)
virtual void unlink_targets()
When overridden in a derived class, unlinks all target blocks from this ISource block.
Definition: agents.h:12559
_AsyncOriginator()
Definition: agents.h:13179
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 message< size_t > * accept_message(runtime_object_identity _MsgId)
Accept the message by making a copy of the payload.
Definition: agents.h:9178
void _Release_ref()
Definition: agents.h:13248
ITarget< typename _Block::source_type > *volatile _M_pLinkedTarget
Definition: agents.h:1732
_Diff _Count
Definition: algorithm:1941
_Greedy_node(ISource< _Type > *_PSource, size_t _Index, ITarget< size_t > *_PTarget, filter_method const &_Filter)
Constructs a _Greedy_node within the default scheduler, and places it on any schedule group of the sc...
Definition: agents.h:8920
_Myt & operator=(const _Myt &_Right)
Definition: agents.h:282
call(_Call_method const &_Func)
Constructs a call messaging block.
Definition: agents.h:5470
#define _Inout_
Definition: sal.h:384
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:9973
virtual bool reserve_message(runtime_object_identity)
Reserves a message previously offered by the source.
Definition: agents.h:8356
_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:11813
void register_filter(filter_method const &_Filter)
Registers a filter method that will be invoked on every received message.
Definition: agents.h:4188
void _Propagate_priority_order(::Concurrency::details::_Queue< message< _Target_type >> &_MessageBuffer)
Propagate messages in priority order
Definition: agents.h:10666
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:4035
~_Queue()
Definition: agents.h:126
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:7342
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:4707
_CRTIMP _Timer(unsigned int _Ms, bool _FRepeating)
volatile bool _M_fIsInitialized
Definition: agents.h:5413
_EType const & const_reference
Definition: agents.h:481
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:10353
virtual void process_incoming_message()
The processing function that is called asynchronously. It dequeues messages and begins processing the...
Definition: agents.h:2217
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:5074
_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:9386
Definition: agents.h:12535
void _Delete_stored_messages()
Deletes all messages currently stored in this message block. Should be called by the destructor to en...
Definition: agents.h:5375
std::tuple< typename std::remove_pointer< _Types >::type::source_type...> type
Definition: agents.h:10268
runtime_object_identity _M_savedId
Definition: agents.h:9243
_Message * _M_pHead
Definition: agents.h:109
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:10283
tuple< typename _Unrefwrap< _Types >::type...> make_tuple(_Types &&..._Args)
Definition: tuple:607
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:5312
_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:9024
const_reference operator[](size_t _Pos) const
Definition: agents.h:344
~_Greedy_node()
Cleans up any resources that may have been created by the _Greedy_node.
Definition: agents.h:9036
Definition: concrt.h:4266
source_link_manager< _SourceLinkRegistry > _SourceLinkManager
The type of the source_link_manager this propagator_block.
Definition: agents.h:3940
void _Init()
Definition: agents.h:384
void remove_network_links()
Removes all the source and target network links from this propagator_block object.
Definition: agents.h:4212
void _Delete_stored_messages()
Deletes all messages currently stored in this message block. Should be called by the destructor to en...
Definition: agents.h:4800
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:1505
single_assignment< size_t > * _M_pSingleAssignment
Definition: agents.h:10114
_Message type
Definition: agents.h:118
void _Reset()
Resets the _Order_node and prepares it for the next propagation
Definition: agents.h:9447
_Join_node()
Constructs a join within the default scheduler, and places it on any schedule group of the scheduler'...
Definition: agents.h:10292
_SavedMessageIdArray _M_savedMessageIdArray
Definition: agents.h:8250
Const Iterator for referenced link manager.
Definition: agents.h:1241
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:4555
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:2973
_LinkRegistry::type _Block
Definition: agents.h:1245
iterator begin()
Returns an iterator to the first element in the source_link_manager object.
Definition: agents.h:1699
A call messaging block is a multi-source, ordered target_block that invokes a specified function when...
Definition: agents.h:5443
ITarget< _Target_type > * _M_pReservedFor
Connected target that is holding a reservation
Definition: agents.h:3821
~timer()
Destroys a timer messaging block.
Definition: agents.h:6563
_MyContainer * _M_pNetwork_link
Definition: agents.h:572
_CRTIMP2 bool done()
Moves an agent into the agent_done state, indicating that the agent has completed.
virtual ~propagator_block()
Destroys a propagator_block object.
Definition: agents.h:3960
long __cdecl _InterlockedIncrement(long volatile *)
join(size_t _NumInputs, filter_method const &_Filter)
Constructs a join messaging block.
Definition: agents.h:7508
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:3711
virtual void release(runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
Definition: agents.h:12604
_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:635
virtual ~message()
Destroys the message object.
Definition: agents.h:1851
call const & operator=(call const &)
virtual void resume_propagation()
Resumes propagation after a reservation has been released.
Definition: agents.h:7846
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:5118
virtual void add(_EType _Link)
Adds a link to the single_link_registry object.
Definition: agents.h:774
::Concurrency::details::_Dynamic_array< _EType > _M_pendingRemove
Definition: agents.h:1726
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:4097
const_reference operator*()
Returns the object pointed to by the iterator
Definition: agents.h:1320
source_block()
Constructs a source_block object.
Definition: agents.h:3248
const size_t COOPERATIVE_WAIT_TIMEOUT
Value indicating that a wait timed out.
Definition: concrt.h:3529
_Dynamic_array< _Type > _Myt
Definition: agents.h:258
message< _Type > * _M_pMessage
Definition: agents.h:13258
long add_ref()
Adds to the reference count for the message object. Used for message blocks that need reference count...
Definition: agents.h:1879
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:4618
virtual void wait()=0
When overridden in a derived class, waits for all asynchronous operations to complete.
#define SIZE_MAX
Definition: limits.h:81
_Order_node_base()
Constructs a _Order_node_base within the default scheduler, and places it on any schedule group of th...
Definition: agents.h:8287
_Network_link_iterator(_Myt const &_Right)
Copy construct an iterator
Definition: agents.h:497
::Concurrency::details::_ReentrantPPLLock _M_resetLock
Definition: agents.h:9658
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:3401
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:12204
_Handler_method _M_processor
A message processing object which exposes the callback to be invoked
Definition: agents.h:2427
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:951
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:11074
::Concurrency::details::_Queue< message< _Type > > _M_messageBuffer
Message queue used to store messages
Definition: agents.h:4829
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:2911
_Check_return_ _In_ long _Size
Definition: io.h:325
void reference()
Acquires a reference on the source_link_manager object.
Definition: agents.h:1617
_CRTIMP void __cdecl _Trace_agents(Agents_EventType _Type, __int64 agentId,...)
void sync_send(_Inout_opt_ message< _Source_type > *_PMessage)
Synchronously send a message for processing.
Definition: agents.h:3136
_Block type
A type that represents the block type stored in the network_link_registry object. ...
Definition: agents.h:603
bool has_value() const
Checks whether this overwrite_buffer messaging block has a value yet.
Definition: agents.h:5032
ordered_message_processor()
Constructs an ordered_message_processor object.
Definition: agents.h:2037
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:2467
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:10443
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:3038
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:1992
_Source_link_iterator(_Myt const &_Right)
Copy construct an iterator
Definition: agents.h:1282
The source_link_manager object manages messaging block network links to ISource blocks.
Definition: agents.h:1231
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:4685
::Concurrency::details::_NonReentrantPPLLock _M_propagationLock
Definition: agents.h:8256
long __cdecl _InterlockedCompareExchange(long volatile *, long, long)
single_link_registry< ITarget< _Type > > _Target_registry
Definition: agents.h:12983
virtual bool reserve_message(runtime_object_identity _MsgId)
Reserves a message previously offered by this timer messaging block.
Definition: agents.h:6680
static const int _S_growthFactor
Definition: agents.h:426
virtual ~_AnonymousOriginator()
Definition: agents.h:12547
virtual void release_message(runtime_object_identity _MsgId)
Releases a previous message reservation.
Definition: agents.h:10456
::Concurrency::details::_NonReentrantPPLLock _M_propagationLock
Definition: agents.h:7406
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:2108
message< _Type > * _M_pMessage
Definition: agents.h:6778
virtual iterator begin()=0
When overridden in a derived class, returns an iterator to the first element in the network_link_regi...
virtual void resume_propagation()
Resumes propagation after a reservation has been released
Definition: agents.h:8406
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:5245
filter_method * _M_pFilter
The filter function which determines whether offered messages should be accepted. ...
Definition: agents.h:3190
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:2860
::Concurrency::details::_Queue< message< _Type > > _M_processedMessages
Message queue used to store processed messages
Definition: agents.h:4823
The concurrent_queue class is a sequence container class that allows first-in, first-out access to it...
Definition: concurrent_queue.h:54
virtual void unlink_target(ITarget< _Type > *_PTarget)
Definition: agents.h:12994
message(message const &_Msg)
Constructs a message object.
Definition: agents.h:1826
void _Grow(size_t _NewSize)
Definition: agents.h:394
_Myt const & operator=(_Myt const &_Right)
Copy assign an iterator
Definition: agents.h:507
The propagator_block class is an abstract base class for message blocks that are both a source and ta...
Definition: agents.h:3926
_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:8596
Greedy join messaging blocks immediately accept a message upon propagation. This is more efficient...
Definition: agents.h:7433
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:12426
virtual void process_message(_Inout_ message< _Type > *_PMessage)
Processes a message that was accepted by this call messaging block.
Definition: agents.h:5751
const _Ty & _Right
Definition: algorithm:4087
virtual void release_message(runtime_object_identity _MsgId)
Releases a previous message reservation.
Definition: agents.h:7315
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:3783
The agent has been created but not started.
Definition: agents.h:11505
virtual void propagate_output_messages()
Propagate messages to targets.
Definition: agents.h:3698
void remove_targets()
Removes all target links for this source block. This should be called from the destructor.
Definition: agents.h:3803
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:10555
virtual void release_ref(_Inout_ ITarget< _Destination_type > *_PTarget)
Releases a reference count on this multiple_join messaging block.
Definition: agents.h:11144
_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:8896
_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:8517
The agent has started.
Definition: agents.h:11515
virtual size_t count()
Counts the number of items in the single_link_registry object.
Definition: agents.h:833
message< _Type > * _M_pGreedyMessage
Definition: agents.h:9233
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:11525
Scheduler * _M_pScheduler
The scheduler to process messages on
Definition: agents.h:2396
virtual void wait()
A processor-specific spin wait used in destructors of message blocks to make sure that all asynchrono...
Definition: agents.h:2188
Const iterator for network link registry. Message blocks should use the link_registry::iterator type ...
Definition: agents.h:470
_AnonymousOriginator()
Definition: agents.h:12542
bool _Enqueue(_Message *_Element)
Definition: agents.h:139
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:6486
target_block()
Constructs a target_block object.
Definition: agents.h:2822
virtual message< size_t > * accept_message(runtime_object_identity _MsgId)
Accept the message by making a copy of the payload.
Definition: agents.h:8754
std::tr1::function< void(message< _Type > *)> _Handler_method
The signature of the callback method invoked while processing messages.
Definition: agents.h:2015
virtual void release_message(runtime_object_identity _MsgId)
Releases a previous message reservation.
Definition: agents.h:6720
The timer has been stopped.
Definition: agents.h:6458
#define _InterlockedIncrementSizeT(_Target)
Definition: concrt.h:110
volatile long _M_fStartable
Definition: agents.h:11761
_Order_node_base const & operator=(_Order_node_base const &)
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:3306
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:7667