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 rclcpp::Context::SharedPtr context =
52 rclcpp::contexts::get_global_default_context(),
62 rclcpp::Context::SharedPtr
112 set_on_trigger_callback(std::function<
void(
size_t)> callback);
115 rclcpp::Context::SharedPtr context_;
117 std::atomic<bool> in_use_by_wait_set_{
false};
118 std::recursive_mutex reentrant_mutex_;
119 std::function<void(
size_t)> on_trigger_callback_{
nullptr};
120 size_t unread_count_{0};
A condition that can be waited on in a single wait set and asynchronously triggered.
RCLCPP_PUBLIC void trigger()
Notify the wait set waiting on this condition, if any, that the condition had been met.
RCLCPP_PUBLIC rcl_guard_condition_t & get_rcl_guard_condition()
Return the underlying rcl guard condition structure.
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.
RCLCPP_PUBLIC rclcpp::Context::SharedPtr get_context() const
Return the context used when creating this guard condition.
RCLCPP_PUBLIC GuardCondition(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.
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.