Function rmw_get_gid_for_client

Function Documentation

rmw_ret_t rmw_get_gid_for_client(const rmw_client_t *client, rmw_gid_t *gid)

Get the globally unique identifier (GID) of a service client.

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

Service clients 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 client concurrently. However, access to the GID is not synchronized. It is not safe to read or write gid while rmw_get_gid_for_client() uses it.

Parameters:
  • client[in] Service client to get a GID from.

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

Pre:

Given client must be a valid service client, as returned by rmw_create_client().

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 client implementation identifier does not match this implementation, or

Returns:

RMW_RET_ERROR if an unspecified error occurs.