Freigeben über


message Class

 

The basic message envelope containing the data payload being passed between messaging blocks.

Syntax

template<class T>
class message : public ::Concurrency::details::_Runtime_object;

Parameters

T
The data type of the payload within the message.

Members

Public Typedefs

Name Description
type A type alias for T.

Public Constructors

Name Description
message::message Constructor Overloaded. Constructs a message object.
message::~message Destructor Destroys the message object.

Public Methods

Name Description
message::add_ref Method Adds to the reference count for the message object. Used for message blocks that need reference counting to determine message lifetimes.
message::msg_id Method Returns the ID of the message object.
message::remove_ref Method Subtracts from the reference count for the message object. Used for message blocks that need reference counting to determine message lifetimes.

Public Data Members

Name Description
message::payload Data Member The payload of the message object.

Remarks

For more information, see Asynchronous Message Blocks.

Inheritance Hierarchy

message

Requirements

Header: agents.h

Namespace: concurrency

message::add_ref Method

Adds to the reference count for the message object. Used for message blocks that need reference counting to determine message lifetimes.

long add_ref();

Return Value

The new value of the reference count.

message::message Constructor

Constructs a message object.

message(
    T const& _P);

message(
    T const& _P,
    runtime_object_identity _Id);

message(
    message const& _Msg);

message(
    _In_ message const* _Msg);

Parameters

_P
The payload of this message.

_Id
The unique ID of this message.

_Msg
A reference or pointer to a message object.

Remarks

The constructor that takes a pointer to a message object as an argument throws an invalid_argument exception if the parameter _Msg is NULL.

message::~message Destructor

Destroys the message object.

virtual ~message();

message::msg_id Method

Returns the ID of the message object.

runtime_object_identity msg_id() const;

Return Value

The runtime_object_identity of the message object.

message::payload Data Member

The payload of the message object.

T const payload;

message::remove_ref Method

Subtracts from the reference count for the message object. Used for message blocks that need reference counting to determine message lifetimes.

long remove_ref();

Return Value

The new value of the reference count.

See Also

concurrency Namespace