-
Notifications
You must be signed in to change notification settings - Fork 81
Description
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
| this->closed = true; |
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.