diff --git a/include/async_mqtt5/detail/async_mutex.hpp b/include/async_mqtt5/detail/async_mutex.hpp index e2c4422..5339c0c 100644 --- a/include/async_mqtt5/detail/async_mutex.hpp +++ b/include/async_mqtt5/detail/async_mutex.hpp @@ -47,10 +47,8 @@ class async_mutex { tracked_op(tracked_op&&) = default; tracked_op(const tracked_op&) = delete; - using executor_type = tracking_type; - executor_type get_executor() const noexcept { - return _executor; - } + tracked_op& operator=(tracked_op&&) = default; + tracked_op& operator=(const tracked_op&) = delete; using allocator_type = asio::associated_allocator_t; allocator_type get_allocator() const noexcept { @@ -63,6 +61,11 @@ class async_mutex { return asio::get_associated_cancellation_slot(_handler); } + using executor_type = tracking_type; + executor_type get_executor() const noexcept { + return _executor; + } + void operator()(error_code ec) { std::move(_handler)(ec); } @@ -104,7 +107,7 @@ class async_mutex { public: template - async_mutex(Executor&& ex) : _ex(std::forward(ex)) {} + explicit async_mutex(Executor&& ex) : _ex(std::forward(ex)) {} async_mutex(const async_mutex&) = delete; async_mutex& operator=(const async_mutex&) = delete; diff --git a/include/async_mqtt5/detail/async_traits.hpp b/include/async_mqtt5/detail/async_traits.hpp index 03eb817..453b9a1 100644 --- a/include/async_mqtt5/detail/async_traits.hpp +++ b/include/async_mqtt5/detail/async_traits.hpp @@ -11,6 +11,7 @@ #include #include +#include #include #include diff --git a/include/async_mqtt5/detail/cancellable_handler.hpp b/include/async_mqtt5/detail/cancellable_handler.hpp index 6188750..0386b15 100644 --- a/include/async_mqtt5/detail/cancellable_handler.hpp +++ b/include/async_mqtt5/detail/cancellable_handler.hpp @@ -42,6 +42,9 @@ class cancellable_handler { cancellable_handler(cancellable_handler&&) = default; cancellable_handler(const cancellable_handler&) = delete; + cancellable_handler& operator=(cancellable_handler&&) = default; + cancellable_handler& operator=(const cancellable_handler&) = delete; + using allocator_type = asio::associated_allocator_t; allocator_type get_allocator() const noexcept { return asio::get_associated_allocator(_handler); diff --git a/include/async_mqtt5/detail/control_packet.hpp b/include/async_mqtt5/detail/control_packet.hpp index 953c8ea..e51c466 100644 --- a/include/async_mqtt5/detail/control_packet.hpp +++ b/include/async_mqtt5/detail/control_packet.hpp @@ -61,7 +61,10 @@ class control_packet { public: control_packet(control_packet&&) noexcept = default; - control_packet(const control_packet&) noexcept = delete; + control_packet(const control_packet&) = delete; + + control_packet& operator=(control_packet&&) noexcept = default; + control_packet& operator=(const control_packet&) = delete; template < typename EncodeFun, @@ -136,6 +139,12 @@ class packet_id_allocator { _free_ids.emplace_back(MAX_PACKET_ID, uint16_t(0)); } + packet_id_allocator(packet_id_allocator&&) noexcept = default; + packet_id_allocator(const packet_id_allocator&) = delete; + + packet_id_allocator& operator=(packet_id_allocator&&) noexcept = default; + packet_id_allocator& operator=(const packet_id_allocator&) = delete; + uint16_t allocate() { if (_free_ids.empty()) return 0; auto& last = _free_ids.back(); diff --git a/include/async_mqtt5/impl/assemble_op.hpp b/include/async_mqtt5/impl/assemble_op.hpp index d2b9315..a27380e 100644 --- a/include/async_mqtt5/impl/assemble_op.hpp +++ b/include/async_mqtt5/impl/assemble_op.hpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -24,7 +25,6 @@ #include - namespace async_mqtt5::detail { namespace asio = boost::asio; @@ -80,16 +80,19 @@ class assemble_op { assemble_op(assemble_op&&) noexcept = default; assemble_op(const assemble_op&) = delete; - using executor_type = typename client_service::executor_type; - executor_type get_executor() const noexcept { - return _svc.get_executor(); - } + assemble_op& operator=(assemble_op&&) noexcept = default; + assemble_op& operator=(const assemble_op&) = delete; using allocator_type = asio::associated_allocator_t; allocator_type get_allocator() const noexcept { return asio::get_associated_allocator(_handler); } + using executor_type = typename client_service::executor_type; + executor_type get_executor() const noexcept { + return _svc.get_executor(); + } + template void perform(CompletionCondition cc) { _read_buff.erase( diff --git a/include/async_mqtt5/impl/async_sender.hpp b/include/async_mqtt5/impl/async_sender.hpp index 2f13c84..53dca4e 100644 --- a/include/async_mqtt5/impl/async_sender.hpp +++ b/include/async_mqtt5/impl/async_sender.hpp @@ -42,6 +42,12 @@ class write_req { _handler(std::move(handler)) {} + write_req(write_req&&) = default; + write_req(const write_req&) = delete; + + write_req& operator=(write_req&&) = default; + write_req& operator=(const write_req&) = delete; + static serial_num_t next_serial_num(serial_num_t last) { return last + 1; } @@ -123,6 +129,12 @@ class async_sender { public: explicit async_sender(ClientService& svc) : _svc(svc) {} + async_sender(async_sender&&) = default; + async_sender(const async_sender&) = delete; + + async_sender& operator=(async_sender&&) = default; + async_sender& operator=(const async_sender&) = delete; + using allocator_type = queue_allocator_type; allocator_type get_allocator() const noexcept { return allocator_type {}; diff --git a/include/async_mqtt5/impl/autoconnect_stream.hpp b/include/async_mqtt5/impl/autoconnect_stream.hpp index 6f4f07f..785e730 100644 --- a/include/async_mqtt5/impl/autoconnect_stream.hpp +++ b/include/async_mqtt5/impl/autoconnect_stream.hpp @@ -71,6 +71,9 @@ class autoconnect_stream { replace_next_layer(construct_next_layer()); } + autoconnect_stream(const autoconnect_stream&) = delete; + autoconnect_stream& operator=(const autoconnect_stream&) = delete; + using next_layer_type = stream_type; next_layer_type& next_layer() { return *_stream_ptr; diff --git a/include/async_mqtt5/impl/client_service.hpp b/include/async_mqtt5/impl/client_service.hpp index 3de87fc..2a558d8 100644 --- a/include/async_mqtt5/impl/client_service.hpp +++ b/include/async_mqtt5/impl/client_service.hpp @@ -133,6 +133,7 @@ class stream_context< mqtt_ctx _mqtt_context; public: explicit stream_context(std::monostate) {} + stream_context(const stream_context& other) : _mqtt_context(other._mqtt_context) {} @@ -271,7 +272,7 @@ class client_service { public: - client_service( + explicit client_service( const executor_type& ex, tls_context_type tls_context = {} ) : diff --git a/include/async_mqtt5/impl/connect_op.hpp b/include/async_mqtt5/impl/connect_op.hpp index 36e9787..9c9eb93 100644 --- a/include/async_mqtt5/impl/connect_op.hpp +++ b/include/async_mqtt5/impl/connect_op.hpp @@ -9,6 +9,9 @@ #define ASYNC_MQTT5_CONNECT_OP_HPP #include +#include +#include +#include #include #include #include @@ -76,13 +79,11 @@ class connect_op { ) {} - connect_op(connect_op&&) noexcept = default; + connect_op(connect_op&&) = default; connect_op(const connect_op&) = delete; - using executor_type = asio::associated_executor_t; - executor_type get_executor() const noexcept { - return asio::get_associated_executor(_handler); - } + connect_op& operator=(connect_op&&) = default; + connect_op& operator=(const connect_op&) = delete; using allocator_type = asio::associated_allocator_t; allocator_type get_allocator() const noexcept { @@ -95,6 +96,11 @@ class connect_op { return _cancellation_state.slot(); } + using executor_type = asio::associated_executor_t; + executor_type get_executor() const noexcept { + return asio::get_associated_executor(_handler); + } + void perform( const epoints& eps, authority_path ap ) { diff --git a/include/async_mqtt5/impl/disconnect_op.hpp b/include/async_mqtt5/impl/disconnect_op.hpp index 8da1595..881e5ad 100644 --- a/include/async_mqtt5/impl/disconnect_op.hpp +++ b/include/async_mqtt5/impl/disconnect_op.hpp @@ -68,7 +68,7 @@ class disconnect_op { disconnect_op(disconnect_op&&) = default; disconnect_op(const disconnect_op&) = delete; - disconnect_op& operator=(disconnect_op&&) noexcept = default; + disconnect_op& operator=(disconnect_op&&) = default; disconnect_op& operator=(const disconnect_op&) = delete; using allocator_type = asio::associated_allocator_t; @@ -200,7 +200,7 @@ class terminal_disconnect_op { terminal_disconnect_op(terminal_disconnect_op&&) = default; terminal_disconnect_op(const terminal_disconnect_op&) = delete; - terminal_disconnect_op& operator=(terminal_disconnect_op&&) noexcept = default; + terminal_disconnect_op& operator=(terminal_disconnect_op&&) = default; terminal_disconnect_op& operator=(const terminal_disconnect_op&) = delete; using allocator_type = asio::associated_allocator_t; diff --git a/include/async_mqtt5/impl/endpoints.hpp b/include/async_mqtt5/impl/endpoints.hpp index 25f7eda..2d022fa 100644 --- a/include/async_mqtt5/impl/endpoints.hpp +++ b/include/async_mqtt5/impl/endpoints.hpp @@ -9,6 +9,9 @@ #define ASYNC_MQTT5_ENDPOINTS_HPP #include +#include +#include +#include #include #include #include @@ -43,10 +46,8 @@ class resolve_op { resolve_op(resolve_op&&) = default; resolve_op(const resolve_op&) = delete; - using executor_type = asio::associated_executor_t; - executor_type get_executor() const noexcept { - return asio::get_associated_executor(_handler); - } + resolve_op& operator=(resolve_op&&) = default; + resolve_op& operator=(const resolve_op&) = delete; using allocator_type = asio::associated_allocator_t; allocator_type get_allocator() const noexcept { @@ -59,6 +60,11 @@ class resolve_op { return asio::get_associated_cancellation_slot(_handler); } + using executor_type = asio::associated_executor_t; + executor_type get_executor() const noexcept { + return asio::get_associated_executor(_handler); + } + void perform() { namespace asioex = boost::asio::experimental; @@ -152,13 +158,16 @@ class endpoints { _resolver(ex), _connect_timer(timer) {} + endpoints(const endpoints&) = delete; + endpoints& operator=(const endpoints&) = delete; + void clone_servers(const endpoints& other) { _servers = other._servers; } using executor_type = asio::ip::tcp::resolver::executor_type; // NOTE: asio::ip::basic_resolver returns executor by value - executor_type get_executor() { + executor_type get_executor() noexcept { return _resolver.get_executor(); } diff --git a/include/async_mqtt5/impl/ping_op.hpp b/include/async_mqtt5/impl/ping_op.hpp index e0e7cb1..2e017e4 100644 --- a/include/async_mqtt5/impl/ping_op.hpp +++ b/include/async_mqtt5/impl/ping_op.hpp @@ -59,9 +59,8 @@ class ping_op { ping_op(ping_op&&) noexcept = default; ping_op(const ping_op&) = delete; - executor_type get_executor() const noexcept { - return _executor; - } + ping_op& operator=(ping_op&&) noexcept = default; + ping_op& operator=(const ping_op&) = delete; using allocator_type = asio::recycling_allocator; allocator_type get_allocator() const noexcept { @@ -73,6 +72,10 @@ class ping_op { return _cancellation_state.slot(); } + executor_type get_executor() const noexcept { + return _executor; + } + void perform() { _ping_timer->expires_after(compute_wait_time()); _ping_timer->async_wait( diff --git a/include/async_mqtt5/impl/publish_rec_op.hpp b/include/async_mqtt5/impl/publish_rec_op.hpp index e1f151f..13ad207 100644 --- a/include/async_mqtt5/impl/publish_rec_op.hpp +++ b/include/async_mqtt5/impl/publish_rec_op.hpp @@ -33,6 +33,7 @@ namespace asio = boost::asio; template class publish_rec_op { using client_service = ClientService; + struct on_puback {}; struct on_pubrec {}; struct on_pubrel {}; @@ -42,23 +43,26 @@ class publish_rec_op { decoders::publish_message _message; public: - publish_rec_op(const std::shared_ptr& svc_ptr) : + explicit publish_rec_op(const std::shared_ptr& svc_ptr) : _svc_ptr(svc_ptr) {} publish_rec_op(publish_rec_op&&) noexcept = default; publish_rec_op(const publish_rec_op&) = delete; - using executor_type = typename client_service::executor_type; - executor_type get_executor() const noexcept { - return _svc_ptr->get_executor(); - } + publish_rec_op& operator=(publish_rec_op&&) noexcept = default; + publish_rec_op& operator=(const publish_rec_op&) = delete; using allocator_type = asio::recycling_allocator; allocator_type get_allocator() const noexcept { return allocator_type {}; } + using executor_type = typename client_service::executor_type; + executor_type get_executor() const noexcept { + return _svc_ptr->get_executor(); + } + void perform(decoders::publish_message message) { auto flags = std::get<2>(message); auto qos_bits = (flags >> 1) & 0b11; diff --git a/include/async_mqtt5/impl/publish_send_op.hpp b/include/async_mqtt5/impl/publish_send_op.hpp index 9b26506..808dd2a 100644 --- a/include/async_mqtt5/impl/publish_send_op.hpp +++ b/include/async_mqtt5/impl/publish_send_op.hpp @@ -91,7 +91,7 @@ class publish_send_op { publish_send_op(publish_send_op&&) = default; publish_send_op(const publish_send_op&) = delete; - publish_send_op& operator=(publish_send_op&&) noexcept = default; + publish_send_op& operator=(publish_send_op&&) = default; publish_send_op& operator=(const publish_send_op&) = delete; using allocator_type = asio::associated_allocator_t; diff --git a/include/async_mqtt5/impl/re_auth_op.hpp b/include/async_mqtt5/impl/re_auth_op.hpp index 40bad8d..8f355c6 100644 --- a/include/async_mqtt5/impl/re_auth_op.hpp +++ b/include/async_mqtt5/impl/re_auth_op.hpp @@ -9,6 +9,7 @@ #define ASYNC_MQTT5_RE_AUTH_OP_hpp #include +#include #include #include @@ -34,24 +35,27 @@ class re_auth_op { any_authenticator& _auth; public: - re_auth_op(const std::shared_ptr& svc_ptr) : + explicit re_auth_op(const std::shared_ptr& svc_ptr) : _svc_ptr(svc_ptr), _auth(_svc_ptr->_stream_context.mqtt_context().authenticator) {} re_auth_op(re_auth_op&&) noexcept = default; - re_auth_op(const re_auth_op&) noexcept = delete; + re_auth_op(const re_auth_op&) = delete; - using executor_type = typename client_service::executor_type; - executor_type get_executor() const noexcept { - return _svc_ptr->get_executor(); - } + re_auth_op& operator=(re_auth_op&&) noexcept = default; + re_auth_op& operator=(const re_auth_op&) = delete; using allocator_type = asio::recycling_allocator; allocator_type get_allocator() const noexcept { return allocator_type {}; } + using executor_type = typename client_service::executor_type; + executor_type get_executor() const noexcept { + return _svc_ptr->get_executor(); + } + void perform() { if (_auth.method().empty()) return; diff --git a/include/async_mqtt5/impl/read_message_op.hpp b/include/async_mqtt5/impl/read_message_op.hpp index a3600a6..d6f01d3 100644 --- a/include/async_mqtt5/impl/read_message_op.hpp +++ b/include/async_mqtt5/impl/read_message_op.hpp @@ -50,15 +50,18 @@ class read_message_op { read_message_op(read_message_op&&) noexcept = default; read_message_op(const read_message_op&) = delete; - executor_type get_executor() const noexcept { - return _executor; - } + read_message_op& operator=(read_message_op&&) noexcept = default; + read_message_op& operator=(const read_message_op&) = delete; using allocator_type = asio::recycling_allocator; allocator_type get_allocator() const noexcept { return allocator_type {}; } + executor_type get_executor() const noexcept { + return _executor; + } + void perform() { _svc_ptr->async_assemble( asio::prepend(std::move(*this), on_message {}) diff --git a/include/async_mqtt5/impl/read_op.hpp b/include/async_mqtt5/impl/read_op.hpp index 3c8baed..43db04f 100644 --- a/include/async_mqtt5/impl/read_op.hpp +++ b/include/async_mqtt5/impl/read_op.hpp @@ -8,6 +8,8 @@ #ifndef ASYNC_MQTT5_READ_OP_HPP #define ASYNC_MQTT5_READ_OP_HPP +#include +#include #include #include #include @@ -40,16 +42,19 @@ class read_op { read_op(read_op&&) = default; read_op(const read_op&) = delete; - using executor_type = asio::associated_executor_t; - executor_type get_executor() const noexcept { - return asio::get_associated_executor(_handler); - } + read_op& operator=(read_op&&) = default; + read_op& operator=(const read_op&) = delete; using allocator_type = asio::associated_allocator_t; allocator_type get_allocator() const noexcept { return asio::get_associated_allocator(_handler); } + using executor_type = asio::associated_executor_t; + executor_type get_executor() const noexcept { + return asio::get_associated_executor(_handler); + } + template void perform( const BufferType& buffer, duration wait_for diff --git a/include/async_mqtt5/impl/reconnect_op.hpp b/include/async_mqtt5/impl/reconnect_op.hpp index 530f51f..689e5d8 100644 --- a/include/async_mqtt5/impl/reconnect_op.hpp +++ b/include/async_mqtt5/impl/reconnect_op.hpp @@ -8,6 +8,9 @@ #ifndef ASYNC_MQTT5_RECONNECT_OP_HPP #define ASYNC_MQTT5_RECONNECT_OP_HPP +#include +#include +#include #include #include #include @@ -76,10 +79,8 @@ class reconnect_op { reconnect_op(reconnect_op&&) = default; reconnect_op(const reconnect_op&) = delete; - using executor_type = asio::associated_executor_t; - executor_type get_executor() const noexcept { - return asio::get_associated_executor(_handler); - } + reconnect_op& operator=(reconnect_op&&) = default; + reconnect_op& operator=(const reconnect_op&) = delete; using allocator_type = asio::associated_allocator_t; allocator_type get_allocator() const noexcept { @@ -92,6 +93,11 @@ class reconnect_op { return asio::get_associated_cancellation_slot(_handler); } + using executor_type = asio::associated_executor_t; + executor_type get_executor() const noexcept { + return asio::get_associated_executor(_handler); + } + void perform(typename Owner::stream_ptr s) { _owner._conn_mtx.lock( asio::prepend(std::move(*this), on_locked {}, s) diff --git a/include/async_mqtt5/impl/replies.hpp b/include/async_mqtt5/impl/replies.hpp index 03c0dc7..a8f50f7 100644 --- a/include/async_mqtt5/impl/replies.hpp +++ b/include/async_mqtt5/impl/replies.hpp @@ -43,6 +43,12 @@ class replies { _ts(std::chrono::system_clock::now()) {} + reply_handler(reply_handler&&) = default; + reply_handler(const reply_handler&) = delete; + + reply_handler& operator=(reply_handler&&) = default; + reply_handler& operator=(const reply_handler&) = delete; + void complete( error_code ec, byte_citer first = byte_citer {}, byte_citer last = byte_citer {} @@ -87,7 +93,13 @@ class replies { public: template - replies(const Executor& ex) : _ex(ex) {} + explicit replies(const Executor& ex) : _ex(ex) {} + + replies(replies&&) = default; + replies(const replies&) = delete; + + replies& operator=(replies&&) = default; + replies& operator=(const replies&) = delete; template decltype(auto) async_wait_reply( diff --git a/include/async_mqtt5/impl/sentry_op.hpp b/include/async_mqtt5/impl/sentry_op.hpp index 32eca77..3af73a8 100644 --- a/include/async_mqtt5/impl/sentry_op.hpp +++ b/include/async_mqtt5/impl/sentry_op.hpp @@ -8,6 +8,8 @@ #ifndef ASYNC_MQTT5_SENTRY_OP_HPP #define ASYNC_MQTT5_SENTRY_OP_HPP +#include + #include #include #include @@ -51,9 +53,8 @@ class sentry_op { sentry_op(sentry_op&&) noexcept = default; sentry_op(const sentry_op&) = delete; - executor_type get_executor() const noexcept { - return _executor; - } + sentry_op& operator=(sentry_op&&) noexcept = default; + sentry_op& operator=(const sentry_op&) = delete; using allocator_type = asio::recycling_allocator; allocator_type get_allocator() const noexcept { @@ -65,6 +66,10 @@ class sentry_op { return _svc_ptr->_cancel_sentry.slot(); } + executor_type get_executor() const noexcept { + return _executor; + } + void perform() { _sentry_timer->expires_after(check_interval); _sentry_timer->async_wait( diff --git a/include/async_mqtt5/impl/subscribe_op.hpp b/include/async_mqtt5/impl/subscribe_op.hpp index 71027cd..2b89c10 100644 --- a/include/async_mqtt5/impl/subscribe_op.hpp +++ b/include/async_mqtt5/impl/subscribe_op.hpp @@ -68,7 +68,7 @@ class subscribe_op { subscribe_op(subscribe_op&&) = default; subscribe_op(const subscribe_op&) = delete; - subscribe_op& operator=(subscribe_op&&) noexcept = default; + subscribe_op& operator=(subscribe_op&&) = default; subscribe_op& operator=(const subscribe_op&) = delete; using allocator_type = asio::associated_allocator_t; diff --git a/include/async_mqtt5/impl/unsubscribe_op.hpp b/include/async_mqtt5/impl/unsubscribe_op.hpp index e1fdf93..ffa56cf 100644 --- a/include/async_mqtt5/impl/unsubscribe_op.hpp +++ b/include/async_mqtt5/impl/unsubscribe_op.hpp @@ -62,7 +62,7 @@ class unsubscribe_op { unsubscribe_op(unsubscribe_op&&) = default; unsubscribe_op(const unsubscribe_op&) = delete; - unsubscribe_op& operator=(unsubscribe_op&&) noexcept = default; + unsubscribe_op& operator=(unsubscribe_op&&) = default; unsubscribe_op& operator=(const unsubscribe_op&) = delete; using allocator_type = asio::associated_allocator_t; diff --git a/include/async_mqtt5/impl/write_op.hpp b/include/async_mqtt5/impl/write_op.hpp index 7cadd59..f59175b 100644 --- a/include/async_mqtt5/impl/write_op.hpp +++ b/include/async_mqtt5/impl/write_op.hpp @@ -8,6 +8,8 @@ #ifndef ASYNC_MQTT5_WRITE_OP_HPP #define ASYNC_MQTT5_WRITE_OP_HPP +#include +#include #include #include #include @@ -35,16 +37,19 @@ class write_op { write_op(write_op&&) = default; write_op(const write_op&) = delete; - using executor_type = asio::associated_executor_t; - executor_type get_executor() const noexcept { - return asio::get_associated_executor(_handler); - } + write_op& operator=(write_op&&) = default; + write_op& operator=(const write_op&) = delete; using allocator_type = asio::associated_allocator_t; allocator_type get_allocator() const noexcept { return asio::get_associated_allocator(_handler); } + using executor_type = asio::associated_executor_t; + executor_type get_executor() const noexcept { + return asio::get_associated_executor(_handler); + } + template void perform(BufferType& buffer) { auto stream_ptr = _owner._stream_ptr; diff --git a/include/async_mqtt5/mqtt_client.hpp b/include/async_mqtt5/mqtt_client.hpp index ea31817..6a2f33f 100644 --- a/include/async_mqtt5/mqtt_client.hpp +++ b/include/async_mqtt5/mqtt_client.hpp @@ -117,7 +117,7 @@ class mqtt_client { * * \details Moved-from client can only be destructed */ - mqtt_client(mqtt_client&& other) noexcept = default; + mqtt_client(mqtt_client&&) noexcept = default; /** diff --git a/include/async_mqtt5/reason_codes.hpp b/include/async_mqtt5/reason_codes.hpp index 84759cd..779df38 100644 --- a/include/async_mqtt5/reason_codes.hpp +++ b/include/async_mqtt5/reason_codes.hpp @@ -55,18 +55,6 @@ class reason_code { constexpr explicit reason_code(uint8_t code) : _code(code) {} /// \endcond - /// Copy constructor. - reason_code(const reason_code&) = default; - - /// Move constructor. - reason_code(reason_code&&) = default; - - /// Copy assignment operator. - reason_code& operator=(const reason_code&) = default; - - /// Move assignment operator. - reason_code& operator=(reason_code&&) = default; - /** * \brief Indication if the object holds a Reason Code indicating an error. * diff --git a/include/async_mqtt5/types.hpp b/include/async_mqtt5/types.hpp index 567d8a6..481498a 100644 --- a/include/async_mqtt5/types.hpp +++ b/include/async_mqtt5/types.hpp @@ -334,18 +334,6 @@ class will : public will_props { _qos(qos), _retain(retain) {} - /// Copy constructor. - will(const will&) = default; - - /// Move constructor. - will(will&&) noexcept = default; - - /// Copy assignment operator. - will& operator=(const will&) = delete; - - /// Move assignment operator. - will& operator=(will&&) noexcept = default; - /// Get the Topic Name. std::string_view topic() const { return _topic; diff --git a/test/include/test_common/delayed_op.hpp b/test/include/test_common/delayed_op.hpp index 8eb4d3d..a5f45aa 100644 --- a/test/include/test_common/delayed_op.hpp +++ b/test/include/test_common/delayed_op.hpp @@ -50,10 +50,8 @@ class delayed_op { delayed_op(delayed_op&&) = default; delayed_op(const delayed_op&) = delete; - using executor_type = asio::steady_timer::executor_type; - executor_type get_executor() const noexcept { - return _timer->get_executor(); - } + delayed_op& operator=(delayed_op&&) = default; + delayed_op& operator=(const delayed_op&) = delete; using allocator_type = asio::recycling_allocator; allocator_type get_allocator() const noexcept { @@ -65,6 +63,11 @@ class delayed_op { return _cancel_slot; } + using executor_type = asio::steady_timer::executor_type; + executor_type get_executor() const noexcept { + return _timer->get_executor(); + } + template void perform(CompletionHandler&& handler) { _cancel_slot = asio::get_associated_cancellation_slot(handler); diff --git a/test/include/test_common/message_exchange.hpp b/test/include/test_common/message_exchange.hpp index 8492cc1..5ae45bb 100644 --- a/test/include/test_common/message_exchange.hpp +++ b/test/include/test_common/message_exchange.hpp @@ -50,6 +50,9 @@ class stream_message { stream_message(const stream_message&) = delete; stream_message(stream_message&&) = default; + stream_message& operator=(stream_message&&) = default; + stream_message& operator=(const stream_message&) = delete; + template auto to_operation(const Executor& ex) { return delayed_op> { @@ -77,8 +80,11 @@ class client_message { _expected_packets({ std::forward(args)... }) {} - client_message(const client_message&) = delete; client_message(client_message&&) = default; + client_message(const client_message&) = delete; + + client_message& operator=(client_message&&) = default; + client_message& operator=(const client_message&) = delete; client_message& complete_with(error_code ec, duration af) { _write_ec = ec; @@ -165,8 +171,11 @@ class broker_message { _owner(owner), _message(ec, af, std::forward(args) ...) {} - broker_message(const broker_message&) = delete; broker_message(broker_message&&) = default; + broker_message(const broker_message&) = delete; + + broker_message& operator=(broker_message&&) = default; + broker_message& operator=(const broker_message&) = delete; template client_message& expect(Args&& ...args); @@ -186,6 +195,14 @@ class msg_exchange { std::vector _from_broker; public: + msg_exchange() = default; + + msg_exchange(msg_exchange&&) = default; + msg_exchange(const msg_exchange&) = delete; + + msg_exchange& operator=(msg_exchange&&) = default; + msg_exchange& operator=(const msg_exchange&) = delete; + template < typename ...Args, std::enable_if_t< diff --git a/test/include/test_common/test_broker.hpp b/test/include/test_common/test_broker.hpp index 4d9f33f..860b047 100644 --- a/test/include/test_common/test_broker.hpp +++ b/test/include/test_common/test_broker.hpp @@ -49,8 +49,12 @@ class pending_read { {} pending_read() = default; + pending_read(pending_read&&) = default; + pending_read(const pending_read&) = delete; + pending_read& operator=(pending_read&&) = default; + pending_read& operator=(const pending_read&) = delete; size_t consume(const std::vector& data) { size_t num_bytes = std::min(_buffer_size, data.size()); @@ -98,7 +102,7 @@ class test_broker : public asio::execution_context::service { std::vector> _cancel_signals; public: - test_broker( + explicit test_broker( asio::execution_context& context, asio::any_io_executor ex = {}, msg_exchange broker_side = {} ) : @@ -108,7 +112,7 @@ class test_broker : public asio::execution_context::service { } test_broker(const test_broker&) = delete; - void operator=(const test_broker&) = delete; + test_broker& operator=(const test_broker&) = delete; executor_type get_executor() const noexcept { return _ex; diff --git a/test/include/test_common/test_service.hpp b/test/include/test_common/test_service.hpp index 3fce041..e8fc680 100644 --- a/test/include/test_common/test_service.hpp +++ b/test/include/test_common/test_service.hpp @@ -32,7 +32,7 @@ class test_service : public async_mqtt5::detail::client_service class overrun_client : public async_mqtt5::detail::client_service { public: - overrun_client(const asio::any_io_executor& ex) : + explicit overrun_client(const asio::any_io_executor& ex) : async_mqtt5::detail::client_service(ex) {} diff --git a/test/include/test_common/test_stream.hpp b/test/include/test_common/test_stream.hpp index 2425406..1e0966e 100644 --- a/test/include/test_common/test_stream.hpp +++ b/test/include/test_common/test_stream.hpp @@ -251,11 +251,12 @@ class test_stream { std::shared_ptr _impl; public: - test_stream(executor_type ex) : + explicit test_stream(executor_type ex) : _impl(std::make_shared(std::move(ex))) {} test_stream(const test_stream&) = delete; + test_stream& operator=(const test_stream&) = delete; ~test_stream() { error_code ec; diff --git a/test/integration/executors.cpp b/test/integration/executors.cpp index c2ad328..00f8e8c 100644 --- a/test/integration/executors.cpp +++ b/test/integration/executors.cpp @@ -258,7 +258,7 @@ BOOST_AUTO_TEST_CASE(immediate_executor_async_subscribe) { } ); c.async_subscribe( - { "+topic" }, subscribe_props {}, std::move(handler) + { "+topic", subscribe_options {} }, subscribe_props{}, std::move(handler) ); ioc.run();