Skip to content

Commit

Permalink
Cleaned up doc comments for the new event consumer methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
fpagliughi committed Jul 7, 2024
1 parent 3ef1292 commit 604716c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
37 changes: 19 additions & 18 deletions include/mqtt/async_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 <typename Rep, class Period>
Expand All @@ -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 <typename Rep, class Period>
event_type try_consume_event_for(const std::chrono::duration<Rep, Period>& relTime) {
Expand All @@ -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 <class Clock, class Duration>
bool try_consume_event_until(
Expand All @@ -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 <class Clock, class Duration>
event_type try_consume_event_until(const std::chrono::time_point<Clock, Duration>& absTime
Expand Down
6 changes: 3 additions & 3 deletions include/mqtt/iasync_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mock_async_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
};

Expand Down

0 comments on commit 604716c

Please sign in to comment.