PahoMqttCpp
MQTT C++ Client for POSIX and Windows
Toggle main menu visibility
Loading...
Searching...
No Matches
delivery_token.h
Go to the documentation of this file.
1
7
8
/*******************************************************************************
9
* Copyright (c) 2013-2016 Frank Pagliughi <fpagliughi@mindspring.com>
10
*
11
* All rights reserved. This program and the accompanying materials
12
* are made available under the terms of the Eclipse Public License v2.0
13
* and Eclipse Distribution License v1.0 which accompany this distribution.
14
*
15
* The Eclipse Public License is available at
16
* http://www.eclipse.org/legal/epl-v20.html
17
* and the Eclipse Distribution License is available at
18
* http://www.eclipse.org/org/documents/edl-v10.php.
19
*
20
* Contributors:
21
* Frank Pagliughi - initial implementation and documentation
22
*******************************************************************************/
23
24
#ifndef __mqtt_delivery_token_h
25
#define __mqtt_delivery_token_h
26
27
#include <memory>
28
29
#include "MQTTAsync.h"
30
#include "
mqtt/message.h
"
31
#include "
mqtt/token.h
"
32
33
namespace
mqtt
{
34
36
42
class
delivery_token
:
public
token
43
{
45
const_message_ptr
msg_;
46
48
friend
class
async_client
;
49
54
void
set_message(
const_message_ptr
msg) { msg_ = msg; }
55
56
public
:
58
using
ptr_t
= std::shared_ptr<delivery_token>;
60
using
const_ptr_t
= std::shared_ptr<delivery_token>;
62
using
weak_ptr_t
= std::weak_ptr<delivery_token>;
63
68
delivery_token
(
iasync_client
& cli) :
token
(
token
::
Type
::
PUBLISH
, cli) {}
74
delivery_token
(
iasync_client
& cli,
const_message_ptr
msg)
75
:
token
(
token
::
Type
::
PUBLISH
, cli, msg->get_topic()), msg_(std::move(msg)) {}
76
86
delivery_token
(
87
iasync_client
& cli,
const_message_ptr
msg,
void
* userContext,
iaction_listener
& cb
88
)
89
:
token
(
token
::
Type
::
PUBLISH
, cli, msg->get_topic(), userContext, cb),
90
msg_(std::move(msg)) {}
91
95
static
ptr_t
create
(
iasync_client
& cli) {
return
std::make_shared<delivery_token>(cli); }
101
static
ptr_t
create
(
iasync_client
& cli,
const_message_ptr
msg) {
102
return
std::make_shared<delivery_token>(cli, msg);
103
}
104
114
static
ptr_t
create
(
115
iasync_client
& cli,
const_message_ptr
msg,
void
* userContext,
iaction_listener
& cb
116
) {
117
return
std::make_shared<delivery_token>(cli, msg, userContext, cb);
118
}
119
123
virtual
const_message_ptr
get_message
()
const
{
return
msg_; }
124
};
125
127
using
delivery_token_ptr
=
delivery_token::ptr_t
;
128
130
using
const_delivery_token_ptr
=
delivery_token::const_ptr_t
;
131
133
}
// namespace mqtt
134
135
#endif
// __mqtt_delivery_token_h
mqtt::delivery_token::delivery_token
delivery_token(iasync_client &cli)
Definition
delivery_token.h:68
mqtt::delivery_token::create
static ptr_t create(iasync_client &cli, const_message_ptr msg)
Definition
delivery_token.h:101
mqtt::delivery_token::delivery_token
delivery_token(iasync_client &cli, const_message_ptr msg, void *userContext, iaction_listener &cb)
Definition
delivery_token.h:86
mqtt::delivery_token::get_message
virtual const_message_ptr get_message() const
Definition
delivery_token.h:123
mqtt::delivery_token::create
static ptr_t create(iasync_client &cli)
Definition
delivery_token.h:95
mqtt::delivery_token::create
static ptr_t create(iasync_client &cli, const_message_ptr msg, void *userContext, iaction_listener &cb)
Definition
delivery_token.h:114
mqtt::delivery_token::ptr_t
std::shared_ptr< delivery_token > ptr_t
Definition
delivery_token.h:58
mqtt::delivery_token::const_ptr_t
std::shared_ptr< delivery_token > const_ptr_t
Definition
delivery_token.h:60
mqtt::delivery_token::delivery_token
delivery_token(iasync_client &cli, const_message_ptr msg)
Definition
delivery_token.h:74
mqtt::delivery_token::async_client
friend class async_client
Definition
delivery_token.h:48
mqtt::delivery_token::weak_ptr_t
std::weak_ptr< delivery_token > weak_ptr_t
Definition
delivery_token.h:62
mqtt::iaction_listener
Definition
iaction_listener.h:50
mqtt::iasync_client
Definition
iasync_client.h:60
mqtt::token::token
token(Type typ, iasync_client &cli)
Definition
token.h:191
mqtt::token::Type
Type
Definition
token.h:64
mqtt::token::PUBLISH
@ PUBLISH
Definition
token.h:64
message.h
mqtt
Definition
async_client.h:60
mqtt::delivery_token_ptr
delivery_token::ptr_t delivery_token_ptr
Definition
delivery_token.h:127
mqtt::const_message_ptr
message::const_ptr_t const_message_ptr
Definition
message.h:372
mqtt::const_delivery_token_ptr
delivery_token::const_ptr_t const_delivery_token_ptr
Definition
delivery_token.h:130
token.h
Generated on
for PahoMqttCpp by
1.17.0