Skip to content

Conversation

@eboasson
Copy link
Contributor

@eboasson eboasson commented Apr 9, 2020

Adds dds_guid_t as a less confusing alias for dds_builtintopic_guid_t. It is alias to retain backwards compatibility. All uses in the sources of Cyclone have been updated.

Adds dds_get_guid to retrieve the GUID of an participant, reader or writer (the only entities visible in the discovery). This is much more convenient (and more efficient) than something like:

dds_entity_t x = dds_create_reader(h, matching_builtin_topic, NULL, NULL);
dds_sample_info_t si;
void *raw = NULL;
dds_instance_handle_t ih;
dds_get_instance_handle(h, &ih);
int32_t n;
dds_read_instance(x, &raw, &si, 1, 1, ih);
(e.g. dds_builtintopic_participant_t *)s = raw;
guid = &s->key;
dds_return_loan(x, &raw, 1);
dds_delete(x);

eboasson added 2 commits April 9, 2020 14:04
The former name should be less confusing.  Backwards compatibility is
preserved by only adding the sensible name as a typedef.

Signed-off-by: Erik Boasson <[email protected]>
This is merely a more convenient way of obtaining it: otherwise one has
subscribe to the correct built-in topic, read the sample corresponding
to the entity's instance handle and get the "key" field.  That's a bit
of a detour to get the network-wide unique identifier.

Signed-off-by: Erik Boasson <[email protected]>
@dpotman
Copy link
Contributor

dpotman commented Apr 9, 2020

LGTM. The only thing I could find is that you're not testing getting a guid from invalid entity kinds in the test case, but as the code in dds_get_guid is so trivial thats not really worth the effort.

@eboasson
Copy link
Contributor Author

eboasson commented Apr 9, 2020

Thanks @dennis-adlink for checking! I agree without about the test ... both in the sense that it really feels like spending time on this particular detail is a waste and in that spending time on improving the tests in that area in general would be a valuable exercise.

@eboasson eboasson merged commit 45c0f43 into eclipse-cyclonedds:master Apr 9, 2020
@eboasson eboasson deleted the add-get-guid-function branch May 10, 2021 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants