![]() |
Paho C++
1.0
The Paho MQTT C++ Client Library
|
Provides a mechanism for tracking the completion of an asynchronous action. More...
#include <token.h>
Public Types | |
| 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 | |
| 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_listener * | get_action_callback () const |
| Gets the action listener for this token. More... | |
| virtual iasync_client * | get_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) |
| 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 and token-related options have special access. | |
| class | token_test |
| class | connect_options |
| class | response_options |
| class | delivery_response_options |
| class | disconnect_options |
Provides a mechanism for tracking the completion of an asynchronous action.
| mqtt::token::token | ( | iasync_client & | cli | ) |
Constructs a token object.
| cli | The client that created the token. |
| mqtt::token::token | ( | iasync_client & | cli, |
| void * | userContext, | ||
| iaction_listener & | cb | ||
| ) |
Constructs a token object.
| cli | The client that created the token. |
| userContext | optional object used to pass context to the callback. Use nullptr if not required. |
| cb | callback listener that will be notified when subscribe has completed |
| mqtt::token::token | ( | iasync_client & | cli, |
| const string & | topic | ||
| ) |
Constructs a token object.
| cli | The client that created the token. |
| topic | The topic assiciated with the token |
| mqtt::token::token | ( | iasync_client & | cli, |
| const string & | topic, | ||
| void * | userContext, | ||
| iaction_listener & | cb | ||
| ) |
Constructs a token object.
| cli | The client that created the token. |
| topic | The topic assiciated with the token |
| userContext | optional object used to pass context to the callback. Use nullptr if not required. |
| cb | callback listener that will be notified when subscribe has completed |
| mqtt::token::token | ( | iasync_client & | cli, |
| const_string_collection_ptr | topics | ||
| ) |
Constructs a token object.
| cli | The client that created the token. |
| topics | The topics associated with the token |
| mqtt::token::token | ( | iasync_client & | cli, |
| const_string_collection_ptr | topics, | ||
| void * | userContext, | ||
| iaction_listener & | cb | ||
| ) |
Constructs a token object.
| cli | The client that created the token. |
| topics | The topics associated with the token |
| userContext | optional object used to pass context to the callback. Use nullptr if not required. |
| cb | callback listener that will be notified when subscribe has completed |
| mqtt::token::token | ( | iasync_client & | cli, |
| MQTTAsync_token | tok | ||
| ) |
Constructs a token object.
| cli | The client that created the token. |
| tok | The message ID |
|
inlinestatic |
Constructs a token object.
| cli | The client that created the token. |
|
inlinestatic |
Constructs a token object.
| cli | The client that created the token. |
| userContext | optional object used to pass context to the callback. Use nullptr if not required. |
| cb | callback listener that will be notified when subscribe has completed |
|
inlinestatic |
Constructs a token object.
| cli | The client that created the token. |
| topic | The topic assiciated with the token |
|
inlinestatic |
Constructs a token object.
| cli | The client that created the token. |
| topic | The topic assiciated with the token |
| userContext | optional object used to pass context to the callback. Use nullptr if not required. |
| cb | callback listener that will be notified when subscribe has completed |
|
inlinestatic |
Constructs a token object.
| cli | The client that created the token. |
| topics | The topics associated with the token |
|
inlinestatic |
Constructs a token object.
| cli | The client that created the token. |
| topics | The topics associated with the token |
| userContext | optional object used to pass context to the callback. Use nullptr if not required. |
| cb | callback listener that will be notified when subscribe has |
|
inlinevirtual |
Gets the action listener for this token.
|
inlinevirtual |
Returns the MQTT client that is responsible for processing the asynchronous action.
|
inlinevirtual |
Returns the ID of the message that is associated with the token.
|
inlinevirtual |
Gets the return code from the action.
This is only valid after the action has completed (i.e. if is_complete() returns true).
|
inlinevirtual |
Gets the topic string(s) for the action being tracked by this token.
|
inlinevirtual |
Retrieve the context associated with an action.
|
inlinevirtual |
Returns whether or not the action has finished.
|
inlinevirtual |
Register a listener to be notified when an action completes.
| listener | The callback to be notified when actions complete. |
|
inlinevirtual |
Store some context associated with an action.
| userContext | optional object used to pass context to the callback. Use nullptr if not required. |
|
inlinevirtual |
Non-blocking check to see if the action has completed.
|
inlinevirtual |
Blocks the current thread until the action this token is associated with has completed.
| timeout | The timeout (in milliseconds) |
|
inline |
Waits a relative amount of time for the action to complete.
| relTime | The amount of time to wait for the event. |
|
inline |
Waits until an absolute time for the action to complete.
| absTime | The absolute time to wait for the event. |