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

template<class _Type>
Concurrency::details::_AnonymousOriginator< _Type >::_AnonymousOriginator ( )
inline
3538  {
3539  }
#define NULL
Definition: vcruntime.h:236
message< _Type > * _M_pMessage
Definition: agents.h:3679
ITarget< _Type > * _M_pTarget
Definition: agents.h:3682
template<class _Type>
virtual Concurrency::details::_AnonymousOriginator< _Type >::~_AnonymousOriginator ( )
inlinevirtual
3543  {
3544  delete _M_pMessage;
3545  }
message< _Type > * _M_pMessage
Definition: agents.h:3679

Member Function Documentation

template<class _Type>
bool Concurrency::details::_AnonymousOriginator< _Type >::_internal_asend ( ITarget< _Type > *  _PTarget,
_Type const &  _Value 
)
inlineprivate
3644  {
3645  _M_pTarget = _PTarget;
3646 
3648  _CONCRT_ASSERT(_M_pTarget->supports_anonymous_source());
3649 
3650  // Create the message
3651  message_status _Status = declined;
3652  message<_Type> * _Msg = new message<_Type>(_Value);
3653 
3655  _M_pMessage = _Msg;
3656 
3657  // Send the message
3658  _Status = _M_pTarget->propagate(_M_pMessage, this);
3659 
3660  // If the message is declined, the destructor will
3661  // delete the message
3662 
3663  // status should not be postponed.
3664  if (_Status == postponed)
3665  {
3666  throw invalid_operation("Messages offered by _AnonymousOriginator shall not be postponed");
3667  }
3668 
3669  return (_Status == accepted);
3670  }
#define NULL
Definition: vcruntime.h:236
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
The target did not accept the message.
Definition: agents.h:1751
The target postponed the message.
Definition: agents.h:1756
message< _Type > * _M_pMessage
Definition: agents.h:3679
message_status
The valid responses for an offer of a message object to a block.
Definition: agents.h:1740
The target accepted the message.
Definition: agents.h:1746
ITarget< _Type > * _M_pTarget
Definition: agents.h:3682
_In_ int _Value
Definition: setjmp.h:173
template<class _Type>
bool Concurrency::details::_AnonymousOriginator< _Type >::_internal_send ( ITarget< _Type > *  _PTarget,
_Type const &  _Value 
)
inlineprivate
3619  {
3620  _M_pTarget = _PTarget;
3621 
3623  _CONCRT_ASSERT(_M_pTarget->supports_anonymous_source());
3624 
3625  // Create the message
3626  message_status _Status = declined;
3627  message<_Type> * _Msg = new message<_Type>(_Value);
3628 
3630  _M_pMessage = _Msg;
3631 
3632  // Send the message
3633  _Status = _M_pTarget->send(_M_pMessage, this);
3634 
3635  // If the message is declined, the destructor will
3636  // delete the message
3637 
3638  // status should not be postponed.
3639  _CONCRT_ASSERT(_Status != postponed);
3640  return (_Status == accepted);
3641  }
#define NULL
Definition: vcruntime.h:236
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
The target did not accept the message.
Definition: agents.h:1751
The target postponed the message.
Definition: agents.h:1756
message< _Type > * _M_pMessage
Definition: agents.h:3679
message_status
The valid responses for an offer of a message object to a block.
Definition: agents.h:1740
The target accepted the message.
Definition: agents.h:1746
ITarget< _Type > * _M_pTarget
Definition: agents.h:3682
_In_ int _Value
Definition: setjmp.h:173
template<class _Type>
virtual message<_Type>* Concurrency::details::_AnonymousOriginator< _Type >::accept ( runtime_object_identity  _MsgId,
ITarget< _Type > *  _PTarget 
)
inlinevirtual
3562  {
3563  if (_PTarget != _M_pTarget)
3564  {
3565  return NULL;
3566  }
3567 
3568  if (_M_pMessage == NULL || _M_pMessage->msg_id() != _MsgId)
3569  {
3570  return NULL;
3571  }
3572 
3573  // The IDs match. Actually transfer ownership of the message and
3574  // unlink away from the target
3575  message<_Type> * _Result = _M_pMessage;
3576 
3577  // The ownership of this message has changed. Set the internal pointer to NULL
3578  // so it won't be deleted in the destructor
3579  _M_pMessage = NULL;
3580 
3581  return _Result;
3582  }
#define NULL
Definition: vcruntime.h:236
message< _Type > * _M_pMessage
Definition: agents.h:3679
ITarget< _Type > * _M_pTarget
Definition: agents.h:3682
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 >.

3605  {
3606  throw invalid_operation("acquire_ref is not supported on _AnonymousOriginator");
3607  }
template<class _Type>
virtual message<_Type>* Concurrency::details::_AnonymousOriginator< _Type >::consume ( runtime_object_identity  _MsgId,
ITarget< _Type > *  _PTarget 
)
inlinevirtual
3592  {
3593  throw invalid_operation("consume is not supported on _AnonymousOriginator");
3594  }
template<class _Type>
virtual void Concurrency::details::_AnonymousOriginator< _Type >::link_target ( ITarget< _Type > *  _PTarget)
inlineprivatevirtual
3674  {
3675  throw invalid_operation("link_target is not supported on _AnonymousOriginator");
3676  }
template<class _Type>
virtual void Concurrency::details::_AnonymousOriginator< _Type >::release ( runtime_object_identity  _MsgId,
ITarget< _Type > *  _PTarget 
)
inlinevirtual
3600  {
3601  throw invalid_operation("release is not supported on _AnonymousOriginator");
3602  }
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 >.

3610  {
3611  throw invalid_operation("release_ref is not supported on _AnonymousOriginator");
3612  }
template<class _Type>
virtual bool Concurrency::details::_AnonymousOriginator< _Type >::reserve ( runtime_object_identity  _MsgId,
ITarget< _Type > *  _PTarget 
)
inlinevirtual
3586  {
3587  throw invalid_operation("reserve is not supported on _AnonymousOriginator");
3588  }
template<class _Type>
virtual void Concurrency::details::_AnonymousOriginator< _Type >::unlink_target ( ITarget< _Type > *  _PTarget)
inlinevirtual
3549  {
3550  throw invalid_operation("unlink_target is not supported on _AnonymousOriginator");
3551  }
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 >.

3555  {
3556  throw invalid_operation("unlink_targets is not supported on _AnonymousOriginator");
3557  }

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: