You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Brief feature description
While using the Cyclone DDS CXX API, I realized that having an API like
is_valid()
(vendor-specific API) forDDScObjectDelegate
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:
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 belowFrom 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 delegatecyclonedds-cxx/src/ddscxx/src/org/eclipse/cyclonedds/core/ObjectDelegate.cpp
Line 57 in ae84dd0
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.
The text was updated successfully, but these errors were encountered: