15 #ifndef RCLCPP__GUARD_CONDITION_HPP_
16 #define RCLCPP__GUARD_CONDITION_HPP_
22 #include "rclcpp/context.hpp"
23 #include "rclcpp/contexts/default_context.hpp"
24 #include "rclcpp/macros.hpp"
25 #include "rclcpp/visibility_control.hpp"
51 const rclcpp::Context::SharedPtr & context =
52 rclcpp::contexts::get_global_default_context(),
127 std::atomic<bool> in_use_by_wait_set_{
false};
128 std::recursive_mutex reentrant_mutex_;
129 std::function<void(
size_t)> on_trigger_callback_{
nullptr};
130 size_t unread_count_{0};
133 void * wait_set_{
nullptr};
A condition that can be waited on in a single wait set and asynchronously triggered.
RCLCPP_PUBLIC void trigger()
Signal that the condition has been met, notifying both the wait set and listeners,...
RCLCPP_PUBLIC GuardCondition(const rclcpp::Context::SharedPtr &context=rclcpp::contexts::get_global_default_context(), rcl_guard_condition_options_t guard_condition_options=rcl_guard_condition_get_default_options())
Construct the guard condition, optionally specifying which Context to use.
RCLCPP_PUBLIC rcl_guard_condition_t & get_rcl_guard_condition()
Return the underlying rcl guard condition structure.
RCLCPP_PUBLIC void set_on_trigger_callback(std::function< void(size_t)> callback)
Set a callback to be called whenever the guard condition is triggered.
RCLCPP_PUBLIC void add_to_wait_set(rcl_wait_set_t &wait_set)
Adds the guard condition to a waitset.
RCLCPP_PUBLIC bool exchange_in_use_by_wait_set_state(bool in_use_state)
Exchange the "in use by wait set" state for this guard condition.
RCL_PUBLIC RCL_WARN_UNUSED rcl_guard_condition_options_t rcl_guard_condition_get_default_options(void)
Return the default options in a rcl_guard_condition_options_t struct.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
Options available for a rcl guard condition.
Handle for a rcl guard condition.
Container for subscription's, guard condition's, etc to be waited on.