STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Concurrency::details::_AnonymousOriginator< _Type > Class Template Reference

#include <agents.h>

Inheritance diagram for Concurrency::details::_AnonymousOriginator< _Type >:
Concurrency::ISource< _Type >

Public Types

typedef single_link_registry< ITarget< _Type > > _Target_registry
 
- Public Types inherited from Concurrency::ISource< _Type >
typedef _Type source_type
 A type alias for _Type . More...
 

Public Member Functions

 _AnonymousOriginator ()
 
virtual ~_AnonymousOriginator ()
 
virtual void unlink_target (ITarget< _Type > *_PTarget)
 
virtual void unlink_targets ()
 When overridden in a derived class, unlinks all target blocks from this ISource block. More...
 
virtual message< _Type > * accept (runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
 
virtual bool reserve (runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
 
virtual message< _Type > * consume (runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
 
virtual void release (runtime_object_identity _MsgId, ITarget< _Type > *_PTarget)
 
virtual void acquire_ref (_Inout_ ITarget< _Type > *)
 When overridden in a derived class, acquires a reference count on this ISource block, to prevent deletion. More...
 
virtual void release_ref (_Inout_ ITarget< _Type > *)
 When overridden in a derived class, releases a reference count on this ISource block. More...
 
- Public Member Functions inherited from Concurrency::ISource< _Type >
virtual ~ISource ()
 Destroys the ISource object. More...
 
virtual void link_target (_Inout_ ITarget< _Type > *_PTarget)=0
 When overridden in a derived class, links a target block to this ISource block. More...
 
virtual void unlink_target (_Inout_ ITarget< _Type > *_PTarget)=0
 When overridden in a derived class, unlinks a target block from this ISource block, if found to be previously linked. More...
 
virtual message< _Type > * accept (runtime_object_identity _MsgId, _Inout_ ITarget< _Type > *_PTarget)=0
 When overridden in a derived class, accepts a message that was offered by this ISource block, transferring ownership to the caller. More...
 
virtual bool reserve (runtime_object_identity _MsgId, _Inout_ ITarget< _Type > *_PTarget)=0
 When overridden in a derived class, reserves a message previously offered by this ISource block. More...
 
virtual message< _Type > * consume (runtime_object_identity _MsgId, _Inout_ ITarget< _Type > *_PTarget)=0
 When overridden in a derived class, consumes a message previously offered by this ISource block and successfully reserved by the target, transferring ownership to the caller. More...
 
virtual void release (runtime_object_identity _MsgId, _Inout_ ITarget< _Type > *_PTarget)=0
 When overridden in a derived class, releases a previous successful message reservation. More...
 

Private Member Functions

bool _internal_send (ITarget< _Type > *_PTarget, _Type const &_Value)
 
bool _internal_asend (ITarget< _Type > *_PTarget, _Type const &_Value)
 
virtual void link_target (ITarget< _Type > *_PTarget)
 

Private Attributes

message< _Type > * _M_pMessage
 
ITarget< _Type > * _M_pTarget
 

Friends

class _Originator
 

Additional Inherited Members

- Protected Member Functions inherited from Concurrency::ISource< _Type >
void _Invoke_link_source (ITarget< _Type > *_PLinkFrom)
 Links this source to a target. More...
 
void _Invoke_unlink_source (ITarget< _Type > *_PUnlinkFrom)
 Unlinks this source from a target. More...
 

Member Typedef Documentation

Constructor & Destructor Documentation

12543  {
12544  }
#define NULL
Definition: crtdbg.h:30
message< _Type > * _M_pMessage
Definition: agents.h:12684
ITarget< _Type > * _M_pTarget
Definition: agents.h:12687
template<class _Type>
virtual Concurrency::details::_AnonymousOriginator< _Type >::~_AnonymousOriginator ( )
inlinevirtual
12548  {
12549  delete _M_pMessage;
12550  }
message< _Type > * _M_pMessage
Definition: agents.h:12684

Member Function Documentation

template<class _Type>
bool Concurrency::details::_AnonymousOriginator< _Type >::_internal_asend ( ITarget< _Type > *  _PTarget,
_Type const &  _Value 
)
inlineprivate
12649  {
12650  _M_pTarget = _PTarget;
12651 
12653  _CONCRT_ASSERT(_M_pTarget->supports_anonymous_source());
12654 
12655  // Create the message
12656  message_status _Status = declined;
12657  message<_Type> * _Msg = new message<_Type>(_Value);
12658 
12660  _M_pMessage = _Msg;
12661 
12662  // Send the message
12663  _Status = _M_pTarget->propagate(_M_pMessage, this);
12664 
12665  // If the message is declined, the destructor will
12666  // delete the message
12667 
12668  // status should not be postponed.
12669  if (_Status == postponed)
12670  {
12671  throw invalid_operation("Messages offered by _AnonymousOriginator shall not be postponed");
12672  }
12673 
12674  return (_Status == accepted);
12675  }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
The target did not accept the message.
Definition: agents.h:1750
The target postponed the message.
Definition: agents.h:1755
#define NULL
Definition: crtdbg.h:30
message< _Type > * _M_pMessage
Definition: agents.h:12684
message_status
The valid responses for an offer of a message object to a block.
Definition: agents.h:1739
The target accepted the message.
Definition: agents.h:1745
ITarget< _Type > * _M_pTarget
Definition: agents.h:12687
template<class _Type>
bool Concurrency::details::_AnonymousOriginator< _Type >::_internal_send ( ITarget< _Type > *  _PTarget,
_Type const &  _Value 
)
inlineprivate
12624  {
12625  _M_pTarget = _PTarget;
12626 
12628  _CONCRT_ASSERT(_M_pTarget->supports_anonymous_source());
12629 
12630  // Create the message
12631  message_status _Status = declined;
12632  message<_Type> * _Msg = new message<_Type>(_Value);
12633 
12635  _M_pMessage = _Msg;
12636 
12637  // Send the message
12638  _Status = _M_pTarget->send(_M_pMessage, this);
12639 
12640  // If the message is declined, the destructor will
12641  // delete the message
12642 
12643  // status should not be postponed.
12644  _CONCRT_ASSERT(_Status != postponed);
12645  return (_Status == accepted);
12646  }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
The target did not accept the message.
Definition: agents.h:1750
The target postponed the message.
Definition: agents.h:1755
#define NULL
Definition: crtdbg.h:30
message< _Type > * _M_pMessage
Definition: agents.h:12684
message_status
The valid responses for an offer of a message object to a block.
Definition: agents.h:1739
The target accepted the message.
Definition: agents.h:1745
ITarget< _Type > * _M_pTarget
Definition: agents.h:12687
template<class _Type>
virtual message<_Type>* Concurrency::details::_AnonymousOriginator< _Type >::accept ( runtime_object_identity  _MsgId,
ITarget< _Type > *  _PTarget 
)
inlinevirtual
12567  {
12568  if (_PTarget != _M_pTarget)
12569  {
12570  return NULL;
12571  }
12572 
12573  if (_M_pMessage == NULL || _M_pMessage->msg_id() != _MsgId)
12574  {
12575  return NULL;
12576  }
12577 
12578  // The IDs match, actaully transfer ownership of the message and
12579  // unlink away from the target
12580  message<_Type> * _Result = _M_pMessage;
12581 
12582  // The ownership of this message has changed. Set the internal pointer to NULL
12583  // so it won't be deleted in the destructor
12584  _M_pMessage = NULL;
12585 
12586  return _Result;
12587  }
#define NULL
Definition: crtdbg.h:30
message< _Type > * _M_pMessage
Definition: agents.h:12684
ITarget< _Type > * _M_pTarget
Definition: agents.h:12687
template<class _Type>
virtual void Concurrency::details::_AnonymousOriginator< _Type >::acquire_ref ( _Inout_ ITarget< _Type > *  _PTarget)
inlinevirtual

When overridden in a derived class, acquires a reference count on this ISource block, to prevent deletion.

Parameters
_PTargetA pointer to the target block that is calling this method.

This method is called by an ITarget object that is being linked to this source during the link_target method.

Implements Concurrency::ISource< _Type >.

12610  {
12611  throw invalid_operation("acquire_ref is not supported on _AnonymousOriginator");
12612  }
template<class _Type>
virtual message<_Type>* Concurrency::details::_AnonymousOriginator< _Type >::consume ( runtime_object_identity  _MsgId,
ITarget< _Type > *  _PTarget 
)
inlinevirtual
12597  {
12598  throw invalid_operation("consume is not supported on _AnonymousOriginator");
12599  }
template<class _Type>
virtual void Concurrency::details::_AnonymousOriginator< _Type >::link_target ( ITarget< _Type > *  _PTarget)
inlineprivatevirtual
12679  {
12680  throw invalid_operation("link_target is not supported on _AnonymousOriginator");
12681  }
template<class _Type>
virtual void Concurrency::details::_AnonymousOriginator< _Type >::release ( runtime_object_identity  _MsgId,
ITarget< _Type > *  _PTarget 
)
inlinevirtual
12605  {
12606  throw invalid_operation("release is not supported on _AnonymousOriginator");
12607  }
template<class _Type>
virtual void Concurrency::details::_AnonymousOriginator< _Type >::release_ref ( _Inout_ ITarget< _Type > *  _PTarget)
inlinevirtual

When overridden in a derived class, releases a reference count on this ISource block.

Parameters
_PTargetA pointer to the target block that is calling this method.

This method is called by an ITarget object that is being unlinked from this source. The source block is allowed to release any resources reserved for the target block.

Implements Concurrency::ISource< _Type >.

12615  {
12616  throw invalid_operation("release_ref is not supported on _AnonymousOriginator");
12617  }
template<class _Type>
virtual bool Concurrency::details::_AnonymousOriginator< _Type >::reserve ( runtime_object_identity  _MsgId,
ITarget< _Type > *  _PTarget 
)
inlinevirtual
12591  {
12592  throw invalid_operation("reserve is not supported on _AnonymousOriginator");
12593  }
template<class _Type>
virtual void Concurrency::details::_AnonymousOriginator< _Type >::unlink_target ( ITarget< _Type > *  _PTarget)
inlinevirtual
12554  {
12555  throw invalid_operation("unlink_target is not supported on _AnonymousOriginator");
12556  }
template<class _Type>
virtual void Concurrency::details::_AnonymousOriginator< _Type >::unlink_targets ( )
inlinevirtual

When overridden in a derived class, unlinks all target blocks from this ISource block.

Implements Concurrency::ISource< _Type >.

12560  {
12561  throw invalid_operation("unlink_targets is not supported on _AnonymousOriginator");
12562  }

Friends And Related Function Documentation

template<class _Type>
friend class _Originator
friend

Member Data Documentation

template<class _Type>
message<_Type>* Concurrency::details::_AnonymousOriginator< _Type >::_M_pMessage
private
template<class _Type>
ITarget<_Type>* Concurrency::details::_AnonymousOriginator< _Type >::_M_pTarget
private

The documentation for this class was generated from the following file: