15 #ifndef RCLCPP__EXPERIMENTAL__CREATE_INTRA_PROCESS_BUFFER_HPP_
16 #define RCLCPP__EXPERIMENTAL__CREATE_INTRA_PROCESS_BUFFER_HPP_
22 #include "rclcpp/experimental/buffers/intra_process_buffer.hpp"
23 #include "rclcpp/experimental/buffers/ring_buffer_implementation.hpp"
24 #include "rclcpp/intra_process_buffer_type.hpp"
25 #include "rclcpp/qos.hpp"
29 namespace experimental
34 typename Alloc = std::allocator<void>,
35 typename Deleter = std::default_delete<MessageT>>
37 create_intra_process_buffer(
40 std::shared_ptr<Alloc> allocator)
42 using MessageSharedPtr = std::shared_ptr<const MessageT>;
43 using MessageUniquePtr = std::unique_ptr<MessageT, Deleter>;
45 size_t buffer_size = qos.
depth();
48 typename IntraProcessBuffer<MessageT, Alloc, Deleter>::UniquePtr buffer;
50 switch (buffer_type) {
53 using BufferT = MessageSharedPtr;
55 auto buffer_implementation =
56 std::make_unique<rclcpp::experimental::buffers::RingBufferImplementation<BufferT>>(
63 std::move(buffer_implementation),
70 using BufferT = MessageUniquePtr;
72 auto buffer_implementation =
73 std::make_unique<rclcpp::experimental::buffers::RingBufferImplementation<BufferT>>(
80 std::move(buffer_implementation),
87 throw std::runtime_error(
"Unrecognized IntraProcessBufferType value");
Encapsulation of Quality of Service settings.
size_t depth() const
Get the history depth.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
@ SharedPtr
Set the data type used in the intra-process buffer as std::shared_ptr<MessageT>
@ UniquePtr
Set the data type used in the intra-process buffer as std::unique_ptr<MessageT>