From 604716c2e75f4282ac828d820bb762498b6e920a Mon Sep 17 00:00:00 2001 From: fpagliughi Date: Sun, 7 Jul 2024 00:29:53 -0400 Subject: [PATCH] Cleaned up doc comments for the new event consumer methods. --- include/mqtt/async_client.h | 37 ++++++++++++++++++----------------- include/mqtt/iasync_client.h | 6 +++--- test/unit/mock_async_client.h | 2 +- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/include/mqtt/async_client.h b/include/mqtt/async_client.h index 78445c9a..c09f0910 100644 --- a/include/mqtt/async_client.h +++ b/include/mqtt/async_client.h @@ -769,7 +769,7 @@ class async_client : public virtual iasync_client * @return @em true is a message was read, @em false if no message was * available. */ - bool try_consume_message(const_message_ptr* msg); + bool try_consume_message(const_message_ptr* msg) override; /** * Waits a limited time for a message to arrive. * @param msg Pointer to the value to receive the message @@ -848,16 +848,16 @@ class async_client : public virtual iasync_client event_type consume_event() override { return que_->get(); } /** * Try to read the next message from the queue without blocking. - * @param msg Pointer to the value to receive the message - * @return @em true is a message was read, @em false if no message was - * available. + * @param evt Pointer to the value to receive the event + * @return @em true if an event was read, @em false if no + * event was available. */ bool try_consume_event(event_type* evt) override { return que_->try_get(evt); } /** * Waits a limited time for a message to arrive. - * @param msg Pointer to the value to receive the message - * @param relTime The maximum amount of time to wait for a message. - * @return @em true if a message was read, @em false if a timeout + * @param evt Pointer to the value to receive the event. + * @param relTime The maximum amount of time to wait for an event. + * @return @em true if an event was read, @em false if a timeout * occurred. */ template @@ -867,10 +867,10 @@ class async_client : public virtual iasync_client return que_->try_get_for(evt, relTime); } /** - * Waits a limited time for a message to arrive. - * @param relTime The maximum amount of time to wait for a message. - * @return A shared pointer to the message that was received. It will be - * empty on timeout. + * Waits a limited time for an event to arrive. + * @param relTime The maximum amount of time to wait for an event. + * @return The event that was received. It will contain empty message on + * timeout. */ template event_type try_consume_event_for(const std::chrono::duration& relTime) { @@ -879,11 +879,11 @@ class async_client : public virtual iasync_client return evt; } /** - * Waits until a specific time for a message to appear. - * @param msg Pointer to the value to receive the message + * Waits until a specific time for an event to appear. + * @param evt Pointer to the value to receive the event. * @param absTime The time point to wait until, before timing out. - * @return @em true if a message was read, @em false if a timeout - * occurred. + * @return @em true if an event was recceived, @em false if a timeout + * occurred. */ template bool try_consume_event_until( @@ -892,9 +892,10 @@ class async_client : public virtual iasync_client return que_->try_get_until(evt, absTime); } /** - * Waits until a specific time for a message to appear. - * @param absTime The time point to wait until, before timing out. - * @return The message, if read, an empty pointer if not. + * Waits until a specific time for an event to appear. + * @param absTime The time point to wait until, before timing out. + * @return The event that was received. It will contain empty message on + * timeout. */ template event_type try_consume_event_until(const std::chrono::time_point& absTime diff --git a/include/mqtt/iasync_client.h b/include/mqtt/iasync_client.h index 0225974a..422febed 100644 --- a/include/mqtt/iasync_client.h +++ b/include/mqtt/iasync_client.h @@ -470,9 +470,9 @@ class iasync_client virtual event_type consume_event() = 0; /** * Try to read the next message from the queue without blocking. - * @param msg Pointer to the value to receive the message - * @return @em true is a message was read, @em false if no message was - * available. + * @param evt Pointer to the value to receive the event + * @return @em true is an event was received, @em false if no event was + * available. */ virtual bool try_consume_event(event_type* evt) = 0; }; diff --git a/test/unit/mock_async_client.h b/test/unit/mock_async_client.h index 27e470cd..02dbbb9e 100644 --- a/test/unit/mock_async_client.h +++ b/test/unit/mock_async_client.h @@ -240,7 +240,7 @@ class mock_async_client : public virtual mqtt::iasync_client bool try_consume_message(const_message_ptr*) override { return false; } - event_type consume_event() { return message_arrived_event{const_message_ptr{}}; } + event_type consume_event() override { return message_arrived_event{const_message_ptr{}}; } bool try_consume_event(event_type* evt) override { return false; } };