rclcpp
master
C++ ROS Client Library API
|
Go to the documentation of this file.
15 #ifndef RCLCPP__MESSAGE_MEMORY_STRATEGY_HPP_
16 #define RCLCPP__MESSAGE_MEMORY_STRATEGY_HPP_
21 #include "rcl/types.h"
35 namespace message_memory_strategy
40 template<
typename MessageT,
typename Alloc = std::allocator<
void>>
80 return std::make_shared<MessageMemoryStrategy<MessageT, Alloc>>(std::make_shared<Alloc>());
92 return std::make_shared<rclcpp::SerializedMessage>(capacity);
115 serialized_msg.
reset();
134 #endif // RCLCPP__MESSAGE_MEMORY_STRATEGY_HPP_
virtual std::shared_ptr< MessageT > borrow_message()
By default, dynamically allocate a new message.
Definition: message_memory_strategy.hpp:85
MessageDeleter message_deleter_
Definition: message_memory_strategy.hpp:119
virtual void return_message(std::shared_ptr< MessageT > &msg)
Release ownership of the message, which will deallocate it if it has no more owners.
Definition: message_memory_strategy.hpp:107
virtual std::shared_ptr< rclcpp::SerializedMessage > borrow_serialized_message()
Definition: message_memory_strategy.hpp:95
typename MessageAllocTraits::allocator_type MessageAlloc
Definition: message_memory_strategy.hpp:47
virtual void return_serialized_message(std::shared_ptr< rclcpp::SerializedMessage > &serialized_msg)
Definition: message_memory_strategy.hpp:112
allocator::Deleter< BufferAlloc, char > BufferDeleter
Definition: message_memory_strategy.hpp:57
size_t default_buffer_capacity_
Definition: message_memory_strategy.hpp:126
SerializedMessageDeleter serialized_message_deleter_
Definition: message_memory_strategy.hpp:122
allocator::Deleter< MessageAlloc, MessageT > MessageDeleter
Definition: message_memory_strategy.hpp:48
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
std::shared_ptr< SerializedMessageAlloc > serialized_message_allocator_
Definition: message_memory_strategy.hpp:121
static SharedPtr create_default()
Default factory method.
Definition: message_memory_strategy.hpp:78
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
std::shared_ptr< BufferAlloc > buffer_allocator_
Definition: message_memory_strategy.hpp:124
virtual void set_default_buffer_capacity(size_t capacity)
Definition: message_memory_strategy.hpp:100
allocator::AllocRebind< MessageT, std::allocator< void > > MessageAllocTraits
Definition: message_memory_strategy.hpp:46
virtual std::shared_ptr< rclcpp::SerializedMessage > borrow_serialized_message(size_t capacity)
Definition: message_memory_strategy.hpp:90
typename std::allocator_traits< Alloc >::template rebind_traits< T > AllocRebind
Definition: allocator_common.hpp:30
typename SerializedMessageAllocTraits::allocator_type SerializedMessageAlloc
Definition: message_memory_strategy.hpp:51
@ SharedPtr
Set the data type used in the intra-process buffer as std::shared_ptr<MessageT>
allocator::AllocRebind< char, std::allocator< void > > BufferAllocTraits
Definition: message_memory_strategy.hpp:55
rcutils_allocator_t rcutils_allocator_
Definition: message_memory_strategy.hpp:128
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
Default allocation strategy for messages received by subscriptions.
Definition: message_memory_strategy.hpp:41
Object oriented version of rcl_serialized_message_t with destructor to avoid memory leaks.
Definition: serialized_message.hpp:27
allocator::AllocRebind< rclcpp::SerializedMessage, std::allocator< void > > SerializedMessageAllocTraits
Definition: message_memory_strategy.hpp:50
typename BufferAllocTraits::allocator_type BufferAlloc
Definition: message_memory_strategy.hpp:56
std::shared_ptr< MessageAlloc > message_allocator_
Definition: message_memory_strategy.hpp:118
BufferDeleter buffer_deleter_
Definition: message_memory_strategy.hpp:125
MessageMemoryStrategy(std::shared_ptr< Alloc > allocator)
Definition: message_memory_strategy.hpp:67
virtual ~MessageMemoryStrategy()=default
allocator::Deleter< SerializedMessageAlloc, rclcpp::SerializedMessage > SerializedMessageDeleter
Definition: message_memory_strategy.hpp:53