Apama  9.12.0.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
com::softwareag::connectivity::Message Class Reference

A container for an payload and associated metadata. More...

#include <sag_connectivity_cpp.hpp>

Inherits sag_underlying_message_t.

Public Types

typedef
com::softwareag::connectivity::metadata_t 
metadata_t
 The type of a message metadata. More...
 
typedef data_t payload_t
 The type of a message payload. More...
 

Public Member Functions

 Message ()
 Construct an empty message. More...
 
 Message (payload_t &&_payload)
 Construct a message from a payload. More...
 
 Message (payload_t &&_payload, metadata_t &&_metadata)
 Construct a message from a payload and metadata. More...
 
 ~Message ()
 Free the underlying payload and metadata. More...
 
 Message (Message &&other)
 Move constructor from another message. More...
 
Messageoperator= (Message &&other)
 Move assignment from another message. More...
 
const payload_tgetPayload () const
 Return a reference to the payload. More...
 
const metadata_tgetMetadata () const
 Return a reference to the metadata. More...
 
payload_tgetPayload ()
 Return a reference to the payload. More...
 
metadata_tgetMetadata ()
 Return a reference to the metadata. More...
 
void setPayload (payload_t &&_payload)
 Set the payload. More...
 
void setMetadata (metadata_t &&_metadata)
 Set the metadata. More...
 
void swap (Message &&other)
 Swap the contents of this message with another. More...
 
Message copy () const
 Return a deep copy of this message, payload and metadata. More...
 
MessageputMetadataValue (const char *key, const char *value)
 Sets a value in the metadata. More...
 
MessageputMetadataValue (data_t &&key, data_t &&value)
 Sets a value in the metadata. More...
 
MessageputMetadataValue (const std::string &key, const std::string &value)
 Sets a value in the metadata. More...
 

Static Public Member Functions

static const char * HOST_MESSAGE_TYPE ()
 Returns the metadata key used by the host for identifying the type of the message - "sag.type". More...
 
static const char * CHANNEL ()
 Returns the metadata key used by the host for identifying the channel of the message - "sag.channel". More...
 

Detailed Description

A container for an payload and associated metadata.

This class is not thread-safe, so users are required to ensure that each instance of Message is only accessed by the codec or transport plug-in that currently owns it, and that only one thread is accessing it at any one time.

Member Typedef Documentation

The type of a message payload.

Constructor & Destructor Documentation

com::softwareag::connectivity::Message::Message ( )

Construct an empty message.

com::softwareag::connectivity::Message::Message ( payload_t &&  _payload)
explicit

Construct a message from a payload.

This is a move constructor so the the argument will be left in an empty state. If you do not want this .copy() otherwise use std::move()

com::softwareag::connectivity::Message::Message ( payload_t &&  _payload,
metadata_t &&  _metadata 
)

Construct a message from a payload and metadata.

This is a move constructor so the the argument will be left in an empty state. If you do not want this use .copy() otherwise use std::move()

com::softwareag::connectivity::Message::~Message ( )

Free the underlying payload and metadata.

com::softwareag::connectivity::Message::Message ( Message &&  other)

Move constructor from another message.

The argument will be left in an empty state. If you do not want this use .copy() otherwise use std::move().

Member Function Documentation

static const char* com::softwareag::connectivity::Message::CHANNEL ( )
inlinestatic

Returns the metadata key used by the host for identifying the channel of the message - "sag.channel".

Message com::softwareag::connectivity::Message::copy ( ) const
inline

Return a deep copy of this message, payload and metadata.

const metadata_t& com::softwareag::connectivity::Message::getMetadata ( ) const

Return a reference to the metadata.

metadata_t& com::softwareag::connectivity::Message::getMetadata ( )
inline

Return a reference to the metadata.

const payload_t& com::softwareag::connectivity::Message::getPayload ( ) const

Return a reference to the payload.

payload_t& com::softwareag::connectivity::Message::getPayload ( )
inline

Return a reference to the payload.

static const char* com::softwareag::connectivity::Message::HOST_MESSAGE_TYPE ( )
inlinestatic

Returns the metadata key used by the host for identifying the type of the message - "sag.type".

Message& com::softwareag::connectivity::Message::operator= ( Message &&  other)
inline

Move assignment from another message.

The argument will be left in an empty state and our old contents freed. If you do not want this use .copy() otherwise use std::move().

Message& com::softwareag::connectivity::Message::putMetadataValue ( const char *  key,
const char *  value 
)

Sets a value in the metadata.

Note this overwrites a previous value if it exists, unlike the insert method on metadata_t.

Message& com::softwareag::connectivity::Message::putMetadataValue ( data_t &&  key,
data_t &&  value 
)

Sets a value in the metadata.

Despite taking a data_t this must only take string value. Using this method may be more efficient even if you are copying the data_t.

 Note this overwrites a previous value if it exists, unlike the insert method on metadata_t.  
Message& com::softwareag::connectivity::Message::putMetadataValue ( const std::string &  key,
const std::string &  value 
)
inline

Sets a value in the metadata.

Note this overwrites a previous value if it exists, unlike the insert method on metadata_t.

void com::softwareag::connectivity::Message::setMetadata ( metadata_t &&  _metadata)

Set the metadata.

This is a move operation so the argument will be left in an empty state and the old metadata freed If you do not want this .copy() otherwise use std::move()

void com::softwareag::connectivity::Message::setPayload ( payload_t &&  _payload)

Set the payload.

This is a move operation so the argument will be left in an empty state and the old payload freed If you do not want this .copy() otherwise use std::move()

void com::softwareag::connectivity::Message::swap ( Message &&  other)

Swap the contents of this message with another.


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