Skip to content

Commit

Permalink
Merge pull request #45 from mauropasse/mauro/exec-void-ptr
Browse files Browse the repository at this point in the history
use void * to pass executor ptr
  • Loading branch information
iRobot ROS authored Feb 17, 2021
2 parents b39ab21 + f13ffb2 commit e6d6426
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion rclcpp/include/rclcpp/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class ClientBase
RCLCPP_PUBLIC
void
set_events_executor_callback(
const rclcpp::executors::EventsExecutor * executor,
rclcpp::executors::EventsExecutor * executor,
rmw_listener_callback_t executor_callback) const;

protected:
Expand Down
6 changes: 2 additions & 4 deletions rclcpp/include/rclcpp/executors/events_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,14 @@ class EventsExecutor : public rclcpp::Executor
// This function is called by the DDS entities when an event happened,
// like a subscription receiving a message.
static void
push_event(const void * executor_ptr, rmw_listener_event_t event)
push_event(void * executor_ptr, rmw_listener_event_t event)
{
// Check if the executor pointer is not valid
if (!executor_ptr) {
throw std::runtime_error("The executor pointer is not valid.");
}

// Cast executor_ptr to this (need to remove constness)
auto this_executor = const_cast<executors::EventsExecutor *>(
static_cast<const executors::EventsExecutor *>(executor_ptr));
auto this_executor = static_cast<executors::EventsExecutor *>(executor_ptr);

// Event queue mutex scope
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class EventsExecutorNotifyWaitable final : public EventWaitable
RCLCPP_PUBLIC
void
set_events_executor_callback(
const rclcpp::executors::EventsExecutor * executor,
rclcpp::executors::EventsExecutor * executor,
rmw_listener_callback_t executor_callback) const override
{
for (auto gc : notify_guard_conditions_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class SubscriptionIntraProcessBase : public rclcpp::Waitable
RCLCPP_PUBLIC
void
set_events_executor_callback(
const rclcpp::executors::EventsExecutor * executor,
rclcpp::executors::EventsExecutor * executor,
rmw_listener_callback_t executor_callback) const override;

protected:
Expand Down
2 changes: 1 addition & 1 deletion rclcpp/include/rclcpp/qos_event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class QOSEventHandlerBase : public Waitable
RCLCPP_PUBLIC
void
set_events_executor_callback(
const rclcpp::executors::EventsExecutor * executor,
rclcpp::executors::EventsExecutor * executor,
rmw_listener_callback_t executor_callback) const override;

protected:
Expand Down
2 changes: 1 addition & 1 deletion rclcpp/include/rclcpp/service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class ServiceBase
RCLCPP_PUBLIC
void
set_events_executor_callback(
const rclcpp::executors::EventsExecutor * executor,
rclcpp::executors::EventsExecutor * executor,
rmw_listener_callback_t executor_callback) const;

protected:
Expand Down
2 changes: 1 addition & 1 deletion rclcpp/include/rclcpp/subscription_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class SubscriptionBase : public std::enable_shared_from_this<SubscriptionBase>
RCLCPP_PUBLIC
void
set_events_executor_callback(
const rclcpp::executors::EventsExecutor * executor,
rclcpp::executors::EventsExecutor * executor,
rmw_listener_callback_t executor_callback) const;

protected:
Expand Down
2 changes: 1 addition & 1 deletion rclcpp/include/rclcpp/waitable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class Waitable
virtual
void
set_events_executor_callback(
const rclcpp::executors::EventsExecutor * executor,
rclcpp::executors::EventsExecutor * executor,
rmw_listener_callback_t executor_callback) const;

private:
Expand Down
2 changes: 1 addition & 1 deletion rclcpp/src/rclcpp/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ ClientBase::exchange_in_use_by_wait_set_state(bool in_use_state)

void
ClientBase::set_events_executor_callback(
const rclcpp::executors::EventsExecutor * executor,
rclcpp::executors::EventsExecutor * executor,
rmw_listener_callback_t executor_callback) const
{
rcl_ret_t ret = rcl_client_set_listener_callback(
Expand Down
2 changes: 1 addition & 1 deletion rclcpp/src/rclcpp/qos_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ QOSEventHandlerBase::is_ready(rcl_wait_set_t * wait_set)

void
QOSEventHandlerBase::set_events_executor_callback(
const rclcpp::executors::EventsExecutor * executor,
rclcpp::executors::EventsExecutor * executor,
rmw_listener_callback_t executor_callback) const
{
rcl_ret_t ret = rcl_event_set_listener_callback(
Expand Down
2 changes: 1 addition & 1 deletion rclcpp/src/rclcpp/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ServiceBase::exchange_in_use_by_wait_set_state(bool in_use_state)

void
ServiceBase::set_events_executor_callback(
const rclcpp::executors::EventsExecutor * executor,
rclcpp::executors::EventsExecutor * executor,
rmw_listener_callback_t executor_callback) const
{
rcl_ret_t ret = rcl_service_set_listener_callback(
Expand Down
2 changes: 1 addition & 1 deletion rclcpp/src/rclcpp/subscription_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ SubscriptionBase::exchange_in_use_by_wait_set_state(

void
SubscriptionBase::set_events_executor_callback(
const rclcpp::executors::EventsExecutor * executor,
rclcpp::executors::EventsExecutor * executor,
rmw_listener_callback_t executor_callback) const
{
rcl_ret_t ret = rcl_subscription_set_listener_callback(
Expand Down
2 changes: 1 addition & 1 deletion rclcpp/src/rclcpp/subscription_intra_process_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ SubscriptionIntraProcessBase::get_actual_qos() const

void
SubscriptionIntraProcessBase::set_events_executor_callback(
const rclcpp::executors::EventsExecutor * executor,
rclcpp::executors::EventsExecutor * executor,
rmw_listener_callback_t executor_callback) const
{
rcl_ret_t ret = rcl_guard_condition_set_listener_callback(
Expand Down
2 changes: 1 addition & 1 deletion rclcpp/src/rclcpp/waitable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Waitable::exchange_in_use_by_wait_set_state(bool in_use_state)

void
Waitable::set_events_executor_callback(
const rclcpp::executors::EventsExecutor * executor,
rclcpp::executors::EventsExecutor * executor,
rmw_listener_callback_t executor_callback) const
{
(void)executor;
Expand Down
2 changes: 1 addition & 1 deletion rclcpp/test/rclcpp/executors/test_executors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ class TestWaitable : public rclcpp::Waitable

void
set_events_executor_callback(
const rclcpp::executors::EventsExecutor * executor,
rclcpp::executors::EventsExecutor * executor,
rmw_listener_callback_t executor_callback) const override
{
rcl_ret_t ret = rcl_guard_condition_set_listener_callback(
Expand Down

0 comments on commit e6d6426

Please sign in to comment.