24#ifndef __mqtt_create_options_h
25#define __mqtt_create_options_h
62 MQTTAsync_createOptions opts_ MQTTAsync_createOptions_initializer5;
79 using ptr_t = std::shared_ptr<create_options>;
92 opts_.MQTTVersion = mqttVersion;
111 explicit create_options(
const string& serverURI,
const string& clientId =
string{})
112 : serverURI_{serverURI}, clientId_{clientId} {}
126 const string& serverURI,
const string& clientId,
const persistence_type& persistence
128 : serverURI_{serverURI}, clientId_{clientId}, persistence_{persistence} {}
143 const string& serverURI,
const string& clientId,
int maxBufferedMessages,
146 : serverURI_{serverURI}, clientId_{clientId}, persistence_{persistence} {
147 opts_.maxBufferedMessages = maxBufferedMessages;
162 const string& serverURI,
const string& clientId,
const create_options& opts,
166 serverURI_{serverURI},
168 persistence_{persistence} {}
175 serverURI_{opts.serverURI_},
176 clientId_{opts.clientId_},
177 persistence_{opts.persistence_} {}
184 serverURI_{std::move(opts.serverURI_)},
185 clientId_{std::move(opts.clientId_)},
186 persistence_{std::move(opts.persistence_)} {}
236 opts_.sendWhileDisconnected =
to_int(on);
237 opts_.allowDisconnectedSendAtAnyTime =
to_int(anyTime);
329 opts_.set_server_uri(serverURI);
337 opts_.set_client_id(clientId);
360 opts_.opts_.sendWhileDisconnected =
to_int(on);
361 opts_.opts_.allowDisconnectedSendAtAnyTime =
to_int(anyTime);
370 opts_.opts_.maxBufferedMessages = n;
378 opts_.opts_.MQTTVersion = ver;
389 opts_.opts_.deleteOldestMessages =
to_int(on);
401 opts_.opts_.restoreMessages =
to_int(on);
411 opts_.opts_.persistQoS0 =
to_int(on);
auto delete_oldest_messages(bool on=true) -> self &
Definition create_options.h:388
create_options_builder self
Definition create_options.h:318
auto restore_messages(bool on=true) -> self &
Definition create_options.h:400
create_options_builder()
Definition create_options.h:322
auto mqtt_version(int ver) -> self &
Definition create_options.h:377
auto persistence(const persistence_type &persistence) -> self &
Definition create_options.h:344
auto server_uri(const string &serverURI) -> self &
Definition create_options.h:328
auto send_while_disconnected(bool on=true, bool anyTime=false) -> self &
Definition create_options.h:359
create_options finalize()
Definition create_options.h:418
auto client_id(const string &clientId) -> self &
Definition create_options.h:336
auto max_buffered_messages(int n) -> self &
Definition create_options.h:369
auto persist_qos0(bool on=true) -> self &
Definition create_options.h:410
Definition create_options.h:60
void set_restore_messages(bool on)
Definition create_options.h:288
const string & get_server_uri() const noexcept
Definition create_options.h:199
create_options(int mqttVersion)
Definition create_options.h:91
bool get_send_while_disconnected() const
Definition create_options.h:224
create_options(int mqttVersion, int maxBufferedMessages)
bool get_restore_messages() const
Definition create_options.h:281
create_options(const create_options &opts)
Definition create_options.h:173
void set_send_while_disconnected(bool on, bool anyTime=false)
Definition create_options.h:235
int mqtt_version() const
Definition create_options.h:253
create_options()
Definition create_options.h:86
void set_client_id(const string &clientId)
Definition create_options.h:204
friend class create_options_builder
Definition create_options.h:75
create_options(create_options &&opts)
Definition create_options.h:182
bool get_delete_oldest_messages() const
Definition create_options.h:267
int get_max_buffered_messages() const
Definition create_options.h:243
create_options(const string &serverURI, const string &clientId, int maxBufferedMessages, const persistence_type &persistence)
Definition create_options.h:142
create_options(const string &serverURI, const string &clientId, const create_options &opts, const persistence_type &persistence)
Definition create_options.h:161
create_options & operator=(create_options &&rhs)
void set_max_buffered_messages(int n)
Definition create_options.h:248
create_options & operator=(const create_options &rhs)
void set_persistence(const persistence_type &persistence)
Definition create_options.h:214
bool get_persist_qos0() const
Definition create_options.h:294
create_options(const string &serverURI, const string &clientId, const persistence_type &persistence)
Definition create_options.h:125
void set_delete_oldest_messages(bool on)
Definition create_options.h:274
std::shared_ptr< create_options > ptr_t
Definition create_options.h:79
friend class async_client
Definition create_options.h:74
create_options(const string &serverURI, const string &clientId=string{})
Definition create_options.h:111
std::shared_ptr< const create_options > const_ptr_t
Definition create_options.h:81
const string & get_client_id() const noexcept
Definition create_options.h:209
const persistence_type & get_persistence() const noexcept
Definition create_options.h:219
void set_mqtt_version(int ver)
Definition create_options.h:258
void set_persist_qos0(bool on)
Definition create_options.h:300
void set_server_uri(const string &serverURI)
Definition create_options.h:194
Definition async_client.h:60
constexpr no_persistence NO_PERSISTENCE
Definition create_options.h:43
bool to_bool(int n)
Definition types.h:107
create_options::ptr_t create_options_ptr
Definition create_options.h:304
std::variant< no_persistence, string, iclient_persistence * > persistence_type
Definition create_options.h:52
int to_int(bool b)
Definition types.h:113
Definition create_options.h:39