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

API to get status of DDScObjectDelegate #97

Open
sumanth-nirmal opened this issue Jun 10, 2021 · 0 comments · May be fixed by #123
Open

API to get status of DDScObjectDelegate #97

sumanth-nirmal opened this issue Jun 10, 2021 · 0 comments · May be fixed by #123

Comments

@sumanth-nirmal
Copy link
Contributor

sumanth-nirmal commented Jun 10, 2021

Brief feature description

While using the Cyclone DDS CXX API, I realized that having an API like is_valid() (vendor-specific API) for DDScObjectDelegate will be helpful to check if the object is valid (checking if it is closed) before accessing the object.

Detailed information

With the current API, when I want to get a ddsc entity of an object then I need to do something like below:

ds::core::cond::StatusCondition & condition{};
auto foo = condition.delegate()->get_ddsc_entity();
...

The get_ddsc_entity() will internally check if the object is closed and throws an exception if it is closed, which is good in most scenarios, but in some use-cases, it is good (or required) to check if the object is valid before accessing anything from this object, something like below

ds::core::cond::StatusCondition & condition{};
if (condition.delegate()->is_valid() {
  auto foo = condition.delegate()->get_ddsc_entity();
  ...
}

From the code, it looks like it is easier to return this variable closed (of course guaranteeing the thread-safe behavior) to know the status of the delegate

I can add this API (assuming this is a sensible request), but I am not sure if I am missing anything here so pining @e-hndrks @k0ekk0ek @reicheratwork for thoughts.
Thanks in Advance.

@sumanth-nirmal sumanth-nirmal linked a pull request Jul 2, 2021 that will close this issue
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 a pull request may close this issue.

1 participant