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

Added rmw_event_type_is_supported #502

Open
wants to merge 5 commits into
base: rolling
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions rmw_zenoh_cpp/src/detail/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ rmw_zenoh_event_type_t zenoh_event_from_rmw_event(rmw_event_type_t rmw_event_typ
return ZENOH_EVENT_INVALID;
}

bool event_check_compatible(rmw_event_type_t rmw_event_type)
{
return zenoh_event_from_rmw_event(rmw_event_type) != ZENOH_EVENT_INVALID;
}

///=============================================================================
rmw_zenoh_event_status_t::rmw_zenoh_event_status_t()
: total_count(0),
Expand Down
2 changes: 2 additions & 0 deletions rmw_zenoh_cpp/src/detail/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ enum rmw_zenoh_event_type_t

rmw_zenoh_event_type_t zenoh_event_from_rmw_event(rmw_event_type_t rmw_event_type);

bool event_check_compatible(rmw_event_type_t rmw_event_type);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're keeping this function, we should update rmw_event.cpp to rely on it. Else we can remove this.


///=============================================================================
/// A struct to store status changes which can be mapped to rmw event statuses.
struct rmw_zenoh_event_status_t
Expand Down
8 changes: 8 additions & 0 deletions rmw_zenoh_cpp/src/rmw_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ rmw_event_set_callback(
return RMW_RET_OK;
}

///=============================================================================
bool
rmw_event_type_is_supported(rmw_event_type_t rmw_event_type)
{
return rmw_zenoh_cpp::zenoh_event_from_rmw_event(rmw_event_type) !=
rmw_zenoh_cpp::ZENOH_EVENT_INVALID;
}

///=============================================================================
rmw_ret_t
rmw_take_event(
Expand Down