15 #ifndef RCLCPP__INTRA_PROCESS_MANAGER_HPP_ 16 #define RCLCPP__INTRA_PROCESS_MANAGER_HPP_ 27 #include <unordered_map> 41 namespace intra_process_manager
191 rclcpp::PublisherBase::SharedPtr publisher,
192 size_t buffer_size = 0);
239 uint64_t intra_process_publisher_id,
244 uint64_t message_seq = 0;
245 mapped_ring_buffer::MappedRingBufferBase::SharedPtr buffer = impl_->get_publisher_info_for_id(
246 intra_process_publisher_id, message_seq);
253 bool did_replace = typed_buffer->push_and_replace(message_seq, message);
257 impl_->store_intra_process_message(intra_process_publisher_id, message_seq);
268 uint64_t intra_process_publisher_id,
273 uint64_t message_seq = 0;
274 mapped_ring_buffer::MappedRingBufferBase::SharedPtr buffer = impl_->get_publisher_info_for_id(
275 intra_process_publisher_id, message_seq);
282 bool did_replace = typed_buffer->push_and_replace(message_seq,
std::move(message));
286 impl_->store_intra_process_message(intra_process_publisher_id, message_seq);
332 uint64_t intra_process_publisher_id,
333 uint64_t message_sequence_number,
334 uint64_t requesting_subscriptions_intra_process_id,
341 size_t target_subs_size = 0;
343 mapped_ring_buffer::MappedRingBufferBase::SharedPtr buffer = impl_->take_intra_process_message(
344 intra_process_publisher_id,
345 message_sequence_number,
346 requesting_subscriptions_intra_process_id,
354 if (target_subs_size) {
356 typed_buffer->get(message_sequence_number, message);
359 typed_buffer->pop(message_sequence_number, message);
367 uint64_t intra_process_publisher_id,
368 uint64_t message_sequence_number,
369 uint64_t requesting_subscriptions_intra_process_id,
376 size_t target_subs_size = 0;
378 mapped_ring_buffer::MappedRingBufferBase::SharedPtr buffer = impl_->take_intra_process_message(
379 intra_process_publisher_id,
380 message_sequence_number,
381 requesting_subscriptions_intra_process_id,
389 if (target_subs_size) {
391 typed_buffer->get(message_sequence_number, message);
394 typed_buffer->pop(message_sequence_number, message);
411 get_next_unique_id();
413 IntraProcessManagerImplBase::SharedPtr impl_;
420 #endif // RCLCPP__INTRA_PROCESS_MANAGER_HPP_
uint64_t store_intra_process_message(uint64_t intra_process_publisher_id, std::unique_ptr< MessageT, Deleter > message)
Definition: intra_process_manager.hpp:267
#define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
void remove_subscription(uint64_t intra_process_subscription_id)
Unregister a subscription using the subscription's unique id.
This header provides the get_node_topics_interface() template function.
Definition: allocator_common.hpp:24
void take_intra_process_message(uint64_t intra_process_publisher_id, uint64_t message_sequence_number, uint64_t requesting_subscriptions_intra_process_id, std::shared_ptr< const MessageT > &message)
Definition: intra_process_manager.hpp:366
size_t get_subscription_count(uint64_t intra_process_publisher_id) const
Return the number of intraprocess subscriptions to a topic, given the publisher id.
Ring buffer container of shared_ptr's or unique_ptr's of T, which can be accessed by a key...
Definition: mapped_ring_buffer.hpp:60
uint64_t store_intra_process_message(uint64_t intra_process_publisher_id, std::shared_ptr< const MessageT > message)
Store a message in the manager, and return the message sequence number.
Definition: intra_process_manager.hpp:238
void take_intra_process_message(uint64_t intra_process_publisher_id, uint64_t message_sequence_number, uint64_t requesting_subscriptions_intra_process_id, std::unique_ptr< MessageT, Deleter > &message)
Take an intra process message.
Definition: intra_process_manager.hpp:331
IntraProcessManager(IntraProcessManagerImplBase::SharedPtr state=create_default_impl())
void remove_publisher(uint64_t intra_process_publisher_id)
Unregister a publisher using the publisher's unique id.
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
bool matches_any_publishers(const rmw_gid_t *id) const
Return true if the given rmw_gid_t matches any stored Publishers.
T static_pointer_cast(T... args)
This class facilitates intra process communication between nodes.
Definition: intra_process_manager.hpp:123
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
uint64_t add_subscription(SubscriptionBase::SharedPtr subscription)
Register a subscription with the manager, returns subscriptions unique id.
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
virtual ~IntraProcessManager()
IntraProcessManagerImplBase::SharedPtr create_default_impl()
uint64_t add_publisher(rclcpp::PublisherBase::SharedPtr publisher, size_t buffer_size=0)
Register a publisher with the manager, returns the publisher unique id.