ROS 2 rclcpp + rcl - lyrical  lyrical
ROS 2 C++ Client Library with ROS Client Library
Public Member Functions | List of all members
rclcpp::EventHandler< EventCallbackT, ParentHandleT > Class Template Reference
Inheritance diagram for rclcpp::EventHandler< EventCallbackT, ParentHandleT >:
Inheritance graph
[legend]
Collaboration diagram for rclcpp::EventHandler< EventCallbackT, ParentHandleT >:
Collaboration graph
[legend]

Public Member Functions

template<typename InitFuncT , typename EventTypeEnum >
 EventHandler (const EventCallbackT &callback, InitFuncT init_func, ParentHandleT parent_handle, EventTypeEnum event_type)
 
std::shared_ptr< void > take_data () override
 Take data so that the callback cannot be scheduled again.
 
std::shared_ptr< void > take_data_by_entity_id ([[maybe_unused]] size_t id) override
 
void execute (const std::shared_ptr< void > &data) override
 Execute any entities of the Waitable that are ready.
 
void disable () override
 Disable the event callback from being called when execute(..) invoked. More...
 
void enable () override
 Enable the event callback to be called when execute(..) invoked. More...
 
- Public Member Functions inherited from rclcpp::EventHandlerBase
RCLCPP_PUBLIC size_t get_number_of_ready_events () override
 Get the number of ready events.
 
RCLCPP_PUBLIC void add_to_wait_set (rcl_wait_set_t &wait_set) override
 Add the Waitable to a wait set.
 
RCLCPP_PUBLIC bool is_ready (const rcl_wait_set_t &wait_set) override
 Check if the Waitable is ready.
 
void set_on_ready_callback (std::function< void(size_t, int)> callback) override
 Set a callback to be called when each new event instance occurs. More...
 
void clear_on_ready_callback () override
 Unset the callback registered for new events, if any.
 
RCLCPP_PUBLIC std::vector< std::shared_ptr< rclcpp::TimerBase > > get_timers () const override
 Returns all timers used by this waitable. More...
 
- Public Member Functions inherited from rclcpp::Waitable
virtual RCLCPP_PUBLIC size_t get_number_of_ready_subscriptions ()
 Get the number of ready subscriptions. More...
 
virtual RCLCPP_PUBLIC size_t get_number_of_ready_timers ()
 Get the number of ready timers. More...
 
virtual RCLCPP_PUBLIC size_t get_number_of_ready_clients ()
 Get the number of ready clients. More...
 
virtual RCLCPP_PUBLIC size_t get_number_of_ready_services ()
 Get the number of ready services. More...
 
virtual RCLCPP_PUBLIC size_t get_number_of_ready_guard_conditions ()
 Get the number of ready guard_conditions. More...
 
virtual RCLCPP_PUBLIC std::shared_ptr< void > take_data_by_entity_id (size_t id)=0
 Take the data so that it can be consumed with execute. More...
 
RCLCPP_PUBLIC bool exchange_in_use_by_wait_set_state (bool in_use_state)
 Exchange the "in use by wait set" state for this timer. More...
 

Additional Inherited Members

- Public Types inherited from rclcpp::EventHandlerBase
enum class  EntityType : std::size_t { Event }
 
- Protected Member Functions inherited from rclcpp::EventHandlerBase
RCLCPP_PUBLIC void set_on_new_event_callback (rcl_event_callback_t callback, const void *user_data)
 
- Protected Attributes inherited from rclcpp::EventHandlerBase
std::recursive_mutex on_new_event_callback_mutex_
 
std::function< void(size_t)> on_new_event_callback_ {nullptr}
 
rcl_event_t event_handle_
 
size_t wait_set_event_index_
 

Detailed Description

template<typename EventCallbackT, typename ParentHandleT>
class rclcpp::EventHandler< EventCallbackT, ParentHandleT >

Definition at line 254 of file event_handler.hpp.

Member Function Documentation

◆ disable()

template<typename EventCallbackT , typename ParentHandleT >
void rclcpp::EventHandler< EventCallbackT, ParentHandleT >::disable ( )
inlineoverridevirtual

Disable the event callback from being called when execute(..) invoked.

This will also temporarily remove the on_new_event_callback from the underlying rmw layer, so that it is not called from the middleware while disabled.

Implements rclcpp::EventHandlerBase.

Definition at line 331 of file event_handler.hpp.

◆ enable()

template<typename EventCallbackT , typename ParentHandleT >
void rclcpp::EventHandler< EventCallbackT, ParentHandleT >::enable ( )
inlineoverridevirtual

Enable the event callback to be called when execute(..) invoked.

This will also set back the on_new_event_callback to the underlying rmw layer, if it was previously removed with disable().

Implements rclcpp::EventHandlerBase.

Definition at line 349 of file event_handler.hpp.


The documentation for this class was generated from the following file: