15 #ifndef RCLCPP__EXPERIMENTAL__SUBSCRIPTION_INTRA_PROCESS_HPP_ 16 #define RCLCPP__EXPERIMENTAL__SUBSCRIPTION_INTRA_PROCESS_HPP_ 33 #include "tracetools/tracetools.h" 37 namespace experimental
44 typename CallbackMessageT = MessageT>
63 std::shared_ptr<Alloc> allocator,
65 const
std::
string & topic_name,
69 any_callback_(callback)
76 buffer_ = rclcpp::experimental::create_intra_process_buffer<MessageT, Alloc, Deleter>(
87 &
gc_, context->get_rcl_context().get(), guard_condition_options);
90 throw std::runtime_error(
"SubscriptionIntraProcess init error initializing guard condition");
94 rclcpp_subscription_callback_added,
96 (
const void *)&any_callback_);
100 any_callback_.register_callback_for_tracing();
107 return buffer_->has_data();
112 execute_impl<CallbackMessageT>();
119 trigger_guard_condition();
126 trigger_guard_condition();
132 return buffer_->use_take_shared_method();
137 trigger_guard_condition()
147 throw std::runtime_error(
"Subscription intra-process can't handle serialized messages");
173 #endif // RCLCPP__EXPERIMENTAL__SUBSCRIPTION_INTRA_PROCESS_HPP_ bool use_take_shared_method() const
Definition: any_subscription_callback.hpp:230
rcl_guard_condition_options_t rcl_guard_condition_get_default_options(void)
Definition: subscription_intra_process_base.hpp:36
void provide_intra_process_message(ConstMessageSharedPtr message)
Definition: subscription_intra_process.hpp:116
Context which encapsulates shared state between nodes and other similar entities. ...
Definition: context.hpp:53
void dispatch_intra_process(ConstMessageSharedPtr message, const rmw_message_info_t &message_info)
Definition: any_subscription_callback.hpp:183
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
Definition: subscription_intra_process.hpp:45
rcl_guard_condition_t gc_
Definition: subscription_intra_process_base.hpp:75
rcl_guard_condition_t rcl_get_zero_initialized_guard_condition(void)
allocator::AllocRebind< MessageT, Alloc > MessageAllocTraits
Definition: subscription_intra_process.hpp:50
rcl_ret_t rcl_trigger_guard_condition(rcl_guard_condition_t *guard_condition)
typename std::allocator_traits< Alloc >::template rebind_traits< T > AllocRebind
Definition: allocator_common.hpp:30
Definition: any_subscription_callback.hpp:36
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
typename MessageAllocTraits::allocator_type MessageAlloc
Definition: subscription_intra_process.hpp:51
void execute()
Execute any entities of the Waitable that are ready.
Definition: subscription_intra_process.hpp:110
bool is_ready(rcl_wait_set_t *wait_set)
Check if the Waitable is ready.
Definition: subscription_intra_process.hpp:104
void provide_intra_process_message(MessageUniquePtr message)
Definition: subscription_intra_process.hpp:123
typename rclcpp::experimental::buffers::IntraProcessBuffer< MessageT, Alloc, Deleter >::UniquePtr BufferUniquePtr
Definition: subscription_intra_process.hpp:59
rcl_ret_t rcl_guard_condition_init(rcl_guard_condition_t *guard_condition, rcl_context_t *context, const rcl_guard_condition_options_t options)
bool use_take_shared_method() const
Definition: subscription_intra_process.hpp:130
IntraProcessBufferType
Definition: intra_process_buffer_type.hpp:23
typename std::conditional< std::is_same< typename std::allocator_traits< Alloc >::template rebind_alloc< T >, typename std::allocator< void >::template rebind< T >::other >::value, std::default_delete< T >, AllocatorDeleter< Alloc > >::type Deleter
Definition: allocator_deleter.hpp:101