rclcpp
master
C++ ROS Client Library API
|
Go to the documentation of this file.
15 #ifndef RCLCPP__EXPERIMENTAL__BUFFERS__INTRA_PROCESS_BUFFER_HPP_
16 #define RCLCPP__EXPERIMENTAL__BUFFERS__INTRA_PROCESS_BUFFER_HPP_
19 #include <type_traits>
29 namespace experimental
41 virtual void clear() = 0;
86 std::shared_ptr<Alloc> allocator =
nullptr)
97 message_allocator_ = std::make_shared<MessageAlloc>();
99 message_allocator_ = std::make_shared<MessageAlloc>(*allocator.get());
107 add_shared_impl<BufferT>(
std::move(msg));
117 return consume_shared_impl<BufferT>();
122 return consume_unique_impl<BufferT>();
127 return buffer_->has_data();
146 template<
typename DestinationT>
156 template<
typename DestinationT>
166 MessageDeleter * deleter = std::get_deleter<MessageDeleter, const MessageT>(shared_msg);
167 auto ptr = MessageAllocTraits::allocate(*message_allocator_.
get(), 1);
168 MessageAllocTraits::construct(*message_allocator_.
get(), ptr, *shared_msg);
179 template<
typename OriginT>
184 consume_shared_impl()
186 return buffer_->dequeue();
190 template<
typename OriginT>
195 consume_shared_impl()
198 return buffer_->dequeue();
202 template<
typename OriginT>
207 consume_unique_impl()
212 MessageDeleter * deleter = std::get_deleter<MessageDeleter, const MessageT>(buffer_msg);
213 auto ptr = MessageAllocTraits::allocate(*message_allocator_.
get(), 1);
214 MessageAllocTraits::construct(*message_allocator_.
get(), ptr, *buffer_msg);
225 template<
typename OriginT>
230 consume_unique_impl()
232 return buffer_->dequeue();
241 #endif // RCLCPP__EXPERIMENTAL__BUFFERS__INTRA_PROCESS_BUFFER_HPP_
bool use_take_shared_method() const override
Definition: intra_process_buffer.hpp:135
MessageUniquePtr consume_unique() override
Definition: intra_process_buffer.hpp:120
bool has_data() const override
Definition: intra_process_buffer.hpp:125
virtual void add_shared(MessageSharedPtr msg)=0
virtual ~TypedIntraProcessBuffer()
Definition: intra_process_buffer.hpp:103
Definition: intra_process_buffer.hpp:34
#define RCLCPP_SMART_PTR_ALIASES_ONLY(...)
Definition: macros.hpp:66
void clear() override
Definition: intra_process_buffer.hpp:130
virtual MessageSharedPtr consume_shared()=0
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
allocator::AllocRebind< MessageT, Alloc > MessageAllocTraits
Definition: intra_process_buffer.hpp:78
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
virtual MessageUniquePtr consume_unique()=0
void add_unique(MessageUniquePtr msg) override
Definition: intra_process_buffer.hpp:110
std::unique_ptr< MessageT, MessageDeleter > MessageUniquePtr
Definition: intra_process_buffer.hpp:80
typename std::allocator_traits< Alloc >::template rebind_traits< T > AllocRebind
Definition: allocator_common.hpp:30
virtual void add_unique(MessageUniquePtr msg)=0
typename MessageAllocTraits::allocator_type MessageAlloc
Definition: intra_process_buffer.hpp:79
Definition: intra_process_buffer.hpp:73
virtual bool use_take_shared_method() const =0
Definition: buffer_implementation_base.hpp:26
virtual bool has_data() const =0
std::shared_ptr< const MessageT > MessageSharedPtr
Definition: intra_process_buffer.hpp:81
Definition: intra_process_buffer.hpp:51
void add_shared(MessageSharedPtr msg) override
Definition: intra_process_buffer.hpp:105
MessageSharedPtr consume_shared() override
Definition: intra_process_buffer.hpp:115