Function rmw_get_gid_for_publisher

Function Documentation

rmw_ret_t rmw_get_gid_for_publisher(const rmw_publisher_t *publisher, rmw_gid_t *gid)

Get the 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.

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 gid while rmw_get_gid_for_publisher() uses it.

Parameters:
  • publisher[in] Publisher to get a gid from.

  • gid[out] Publisher’s unique identifier, populated on success but left unchanged on failure.

Pre:

Given publisher must be a valid publisher, as returned by rmw_create_publisher().

Returns:

RMW_RET_OK if successful, or

Returns:

RMW_RET_INVALID_ARGUMENT if publisher is NULL, or

Returns:

RMW_RET_INVALID_ARGUMENT if gid is NULL, or

Returns:

RMW_RET_INCORRECT_RMW_IMPLEMENTATION if the publisher implementation identifier does not match this implementation, or

Returns:

RMW_RET_ERROR if an unspecified error occurs.