Skip to content
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

Question - Need a way to get the GUID for any entity in C++ #466

Open
ashishkcork opened this issue Jan 19, 2024 · 2 comments
Open

Question - Need a way to get the GUID for any entity in C++ #466

ashishkcork opened this issue Jan 19, 2024 · 2 comments

Comments

@ashishkcork
Copy link

Hi,
I am using the cyconedds-cxx and fairly new to this.
I am am trying to get the GUID of different entities like domain-participant, publisher, subscriber, reader, writer.
Is there a way to get this? Little struggling to get this through the current documentation and examples.

I see that many of these classes have this API called instance_handle() which has another member called handle().
which is of this type.
typedef uint64_t dds_instance_handle_t;

I have an option access to link the cyclonedds (C library). -- There I see the API to get the GUID.

void foo(dds_entity_t handle) {
dds_guid_t guid_h;
dds_get_guid(handle, &guid_h)
}

where this dds_entity_t coming from C library.
typedef int32_t dds_entity_t;

I was thinking if we can get the corresponding dds_entity_t from the C++ dds_instance_handle_t so that I can somehow get the GUID of any entity.

Any pointers/help will be highly appreciated.
It's not an issue, Just want to know the answer, kind of question.

@eboasson
Copy link
Contributor

eboasson commented Jan 26, 2024

Hi @ashishkcork, I suppose this is yet another one of those cases where the C++ API doesn't fully cover the C API. It should, and I am it sure it would if C++ was my preferred language ...

Anyway:

I was thinking if we can get the corresponding dds_entity_t from the C++ dds_instance_handle_t so that I can somehow get the GUID of any entity.

I can help you with:

DomainParticipant dp();
dds_entity_t c_handle = dp->get_ddsc_entity();

should work (mind the -> instead of .; this should work for C++ participants, readers and writers) Then you can indeed do dds_get_guid(c_handle...) like you were thinking.

@ashishkumarforgit
Copy link

Thanks for the help. Very much appreciated.

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

No branches or pull requests

3 participants