Function rmw_get_gid_for_publisher
Defined in File rmw.h
Function Documentation
-
rmw_ret_t rmw_get_gid_for_publisher(const rmw_publisher_t *publisher, rmw_gid_t *gid)
Get the globally unique identifier (GID) of a publisher.
Attribute
Adherence
Allocates Memory
No
Thread-Safe
Yes
Uses Atomics
Maybe [1]
Lock-Free
Maybe [1]
[1] implementation defined, check implementation documentation.
This is expected to be globally unique within a ROS domain. The identifier should be the same when reported both locally (where the entity was created) and on remote hosts or processes.
- 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. It is not safe to read or write
gidwhile rmw_get_gid_for_publisher() uses it.
- Pre:
Given
publishermust be a valid publisher, as returned by rmw_create_publisher().- Parameters:
publisher – [in] Publisher to get a GID from.
gid – [out] Publisher’s unique identifier, populated on success but left unchanged on failure.
- Returns:
RMW_RET_OKif successful, or- Returns:
RMW_RET_INVALID_ARGUMENTifpublisheris NULL, or- Returns:
RMW_RET_INVALID_ARGUMENTifgidis NULL, or- Returns:
RMW_RET_INCORRECT_RMW_IMPLEMENTATIONif thepublisherimplementation identifier does not match this implementation, or- Returns:
RMW_RET_ERRORif an unspecified error occurs.