Paho C++  1.0
The Paho MQTT C++ Client Library
 All Classes Files Functions Variables Typedefs Friends
mqtt::delivery_token Class Reference

Provides a mechanism to track the delivery progress of a message. More...

#include <delivery_token.h>

Inheritance diagram for mqtt::delivery_token:
mqtt::token

Public Types

using ptr_t = std::shared_ptr< delivery_token >
 Smart/shared pointer to an object of this class.
 
using const_ptr_t = std::shared_ptr< delivery_token >
 Smart/shared pointer to a const object of this class.
 
using weak_ptr_t = std::weak_ptr< delivery_token >
 Weak pointer to an object of this class.
 
- Public Types inherited from mqtt::token
using ptr_t = std::shared_ptr< token >
 Smart/shared pointer to an object of this class.
 
using const_ptr_t = std::shared_ptr< const token >
 Smart/shared pointer to an object of this class.
 
using weak_ptr_t = std::weak_ptr< token >
 Weak pointer to an object of this class.
 

Public Member Functions

 delivery_token (iasync_client &cli)
 Creates an empty delivery token connected to a particular client. More...
 
 delivery_token (iasync_client &cli, const_message_ptr msg)
 Creates a delivery token connected to a particular client. More...
 
 delivery_token (iasync_client &cli, const_message_ptr msg, void *userContext, iaction_listener &cb)
 Creates a delivery token connected to a particular client. More...
 
virtual const_message_ptr get_message () const
 Gets the message associated with this token. More...
 
- Public Member Functions inherited from mqtt::token
 token (iasync_client &cli)
 Constructs a token object. More...
 
 token (iasync_client &cli, void *userContext, iaction_listener &cb)
 Constructs a token object. More...
 
 token (iasync_client &cli, const string &topic)
 Constructs a token object. More...
 
 token (iasync_client &cli, const string &topic, void *userContext, iaction_listener &cb)
 Constructs a token object. More...
 
 token (iasync_client &cli, const_string_collection_ptr topics)
 Constructs a token object. More...
 
 token (iasync_client &cli, const_string_collection_ptr topics, void *userContext, iaction_listener &cb)
 Constructs a token object. More...
 
 token (iasync_client &cli, MQTTAsync_token tok)
 Constructs a token object. More...
 
virtual ~token ()
 Virtual destructor.
 
virtual iaction_listenerget_action_callback () const
 Gets the action listener for this token. More...
 
virtual iasync_clientget_client () const
 Returns the MQTT client that is responsible for processing the asynchronous action. More...
 
virtual int get_message_id () const
 Returns the ID of the message that is associated with the token. More...
 
virtual const_string_collection_ptr get_topics () const
 Gets the topic string(s) for the action being tracked by this token. More...
 
virtual void * get_user_context () const
 Retrieve the context associated with an action. More...
 
virtual bool is_complete () const
 Returns whether or not the action has finished. More...
 
virtual int get_return_code () const
 Gets the return code from the action. More...
 
virtual void set_action_callback (iaction_listener &listener)
 Register a listener to be notified when an action completes. More...
 
virtual void set_user_context (void *userContext)
 Store some context associated with an action. More...
 
virtual void wait ()
 Blocks the current thread until the action this token is associated with has completed.
 
virtual bool try_wait ()
 Non-blocking check to see if the action has completed. More...
 
virtual bool wait_for (long timeout)
 Blocks the current thread until the action this token is associated with has completed. More...
 
template<class Rep , class Period >
bool wait_for (const std::chrono::duration< Rep, Period > &relTime)
 Waits a relative amount of time for the action to complete. More...
 
template<class Clock , class Duration >
bool wait_until (const std::chrono::time_point< Clock, Duration > &absTime)
 Waits until an absolute time for the action to complete. More...
 

Static Public Member Functions

static ptr_t create (iasync_client &cli)
 Creates an empty delivery token connected to a particular client. More...
 
static ptr_t create (iasync_client &cli, const_message_ptr msg)
 Creates a delivery token connected to a particular client. More...
 
static ptr_t create (iasync_client &cli, const_message_ptr msg, void *userContext, iaction_listener &cb)
 Creates a delivery token connected to a particular client. More...
 
- Static Public Member Functions inherited from mqtt::token
static ptr_t create (iasync_client &cli)
 Constructs a token object. More...
 
static ptr_t create (iasync_client &cli, void *userContext, iaction_listener &cb)
 Constructs a token object. More...
 
static ptr_t create (iasync_client &cli, const string &topic)
 Constructs a token object. More...
 
static ptr_t create (iasync_client &cli, const string &topic, void *userContext, iaction_listener &cb)
 Constructs a token object. More...
 
static ptr_t create (iasync_client &cli, const_string_collection_ptr topics)
 Constructs a token object. More...
 
static ptr_t create (iasync_client &cli, const_string_collection_ptr topics, void *userContext, iaction_listener &cb)
 Constructs a token object. More...
 

Friends

class async_client
 Client has special access. More...
 

Detailed Description

Provides a mechanism to track the delivery progress of a message.

Used to track the the delivery progress of a message when a publish is executed in a non-blocking manner (run in the background) action.

Constructor & Destructor Documentation

mqtt::delivery_token::delivery_token ( iasync_client cli)
inline

Creates an empty delivery token connected to a particular client.

Parameters
cliThe asynchronous client object.
mqtt::delivery_token::delivery_token ( iasync_client cli,
const_message_ptr  msg 
)
inline

Creates a delivery token connected to a particular client.

Parameters
cliThe asynchronous client object.
msgThe message being tracked.
mqtt::delivery_token::delivery_token ( iasync_client cli,
const_message_ptr  msg,
void *  userContext,
iaction_listener cb 
)
inline

Creates a delivery token connected to a particular client.

Parameters
cliThe asynchronous client object.
msgThe message data.
userContextoptional object used to pass context to the callback. Use nullptr if not required.
cbcallback optional listener that will be notified when message delivery has completed to the requested quality of service

Member Function Documentation

static ptr_t mqtt::delivery_token::create ( iasync_client cli)
inlinestatic

Creates an empty delivery token connected to a particular client.

Parameters
cliThe asynchronous client object.
static ptr_t mqtt::delivery_token::create ( iasync_client cli,
const_message_ptr  msg 
)
inlinestatic

Creates a delivery token connected to a particular client.

Parameters
cliThe asynchronous client object.
msgThe message data.
static ptr_t mqtt::delivery_token::create ( iasync_client cli,
const_message_ptr  msg,
void *  userContext,
iaction_listener cb 
)
inlinestatic

Creates a delivery token connected to a particular client.

Parameters
cliThe asynchronous client object.
msgThe message data.
userContextoptional object used to pass context to the callback. Use nullptr if not required.
cbcallback optional listener that will be notified when message delivery has completed to the requested quality of service
virtual const_message_ptr mqtt::delivery_token::get_message ( ) const
inlinevirtual

Gets the message associated with this token.

Returns
The message associated with this token.

Friends And Related Function Documentation

friend class async_client
friend

Client has special access.


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