-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update gid API documentation. #274
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2081,23 +2081,69 @@ rmw_count_subscribers( | |||||||||
const char * topic_name, | ||||||||||
size_t * count); | ||||||||||
|
||||||||||
/// Get the unique identifier of the publisher | ||||||||||
/// Get the unique identifier or gid of a publisher. | ||||||||||
/** | ||||||||||
* \param[in] publisher The publisher to get the gid of | ||||||||||
* \param[out] gid The resulting gid | ||||||||||
* \return RMW_RET_OK if successful, otherwise an appropriate error code | ||||||||||
* <hr> | ||||||||||
* Attribute | Adherence | ||||||||||
* ------------------ | ------------- | ||||||||||
* Allocates Memory | No | ||||||||||
* Thread-Safe | Yes | ||||||||||
* Uses Atomics | Maybe [1] | ||||||||||
* Lock-Free | Maybe [1] | ||||||||||
* | ||||||||||
* <i>[1] implementation defined, check implementation documentation.</i> | ||||||||||
* | ||||||||||
* \par Thread-safety | ||||||||||
* Publishers are thread-safe objects, and so are all operations on them except for | ||||||||||
* finalization. | ||||||||||
* Therefore, it is safe to get the unique identifier from the same publisher concurrently. | ||||||||||
* However, Access to the gid is not synchronized. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See 8899558. |
||||||||||
* It is not safe to read or write `gid` while rmw_get_gid_for_publisher() uses it. | ||||||||||
* | ||||||||||
* \pre Given `publisher` must be a valid subscription, as returned by rmw_create_publisher(). | ||||||||||
* | ||||||||||
* \param[in] publisher Publisher to be get a gid from. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in a680b34. |
||||||||||
* \param[out] gid Publisher's unique identifier, populated on success | ||||||||||
* but left unchanged on failure. | ||||||||||
* \return `RMW_RET_OK` if successful, o | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oof, I clearly did this in rush. See 8899558. |
||||||||||
* \return `RMW_RET_INVALID_ARGUMENT` if `publisher` is NULL, or | ||||||||||
* \return `RMW_RET_INVALID_ARGUMENT` if `gid` is NULL, or | ||||||||||
* \return `RMW_RET_INCORRECT_RMW_IMPLEMENTATION` if the `publisher` implementation | ||||||||||
* identifier does not match this implementation, or | ||||||||||
* \return `RMW_RET_ERROR` if an unspecified error occurs. | ||||||||||
*/ | ||||||||||
RMW_PUBLIC | ||||||||||
RMW_WARN_UNUSED | ||||||||||
rmw_ret_t | ||||||||||
rmw_get_gid_for_publisher(const rmw_publisher_t * publisher, rmw_gid_t * gid); | ||||||||||
|
||||||||||
/// Check if two gid objects are the same | ||||||||||
/// Check if two unique identifiers or gids are equal. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See 8899558. |
||||||||||
/** | ||||||||||
* \param[in] gid1 One gid1 to compare | ||||||||||
* \param[in] gid2 The other gid to compare | ||||||||||
* \param[out] bool true if the gid objects match, false otherwise | ||||||||||
* \return RMW_RET_OK if successful, otherwise an appropriate error code | ||||||||||
* <hr> | ||||||||||
* Attribute | Adherence | ||||||||||
* ------------------ | ------------- | ||||||||||
* Allocates Memory | No | ||||||||||
* Thread-Safe | Yes | ||||||||||
* Uses Atomics | Maybe [1] | ||||||||||
* Lock-Free | Maybe [1] | ||||||||||
* | ||||||||||
* <i>[1] implementation defined, check implementation documentation.</i> | ||||||||||
* | ||||||||||
* \par Thread-safety | ||||||||||
* Unique identifier comparison is a reentrant function, but: | ||||||||||
* - Access to both gids is read-only but it is not synchronized. | ||||||||||
* Concurrent `gid1` and `gid2` reads are safe, but concurrent reads and writes are not. | ||||||||||
* - Access to primitive data-type arguments is not synchronized. | ||||||||||
* It is not safe to read or write `result` while rmw_compare_gids_equal() uses it. | ||||||||||
* | ||||||||||
* \param[in] gid1 First unique identifier to compare. | ||||||||||
* \param[in] gid2 Second unique identifier to compare. | ||||||||||
* \param[out] bool true if both gids are equal, false otherwise. | ||||||||||
* \return `RMW_RET_OK` if successful, | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See 8899558. |
||||||||||
* \return `RMW_RET_INVALID_ARGUMENT` if `gid1` or `gid2` is NULL, or | ||||||||||
* \return `RMW_RET_INCORRECT_RMW_IMPLEMENTATION` if `gid1`'s' or `gid2`'s' implementation | ||||||||||
* identifier does the match this implementation, or | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See 8899558. |
||||||||||
* \return `RMW_RET_ERROR` if an unspecified error occurs. | ||||||||||
*/ | ||||||||||
RMW_PUBLIC | ||||||||||
RMW_WARN_UNUSED | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(is that what is meant here?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeap, yeap. See 8899558.