15 #ifndef RCLCPP__MESSAGE_MEMORY_STRATEGY_HPP_ 16 #define RCLCPP__MESSAGE_MEMORY_STRATEGY_HPP_ 34 namespace message_memory_strategy
39 template<
typename MessageT,
typename Alloc = std::allocator<
void>>
63 rcutils_allocator_ = allocator::get_rcl_allocator<char, BufferAlloc>(*buffer_allocator_.get());
71 rcutils_allocator_ = allocator::get_rcl_allocator<char, BufferAlloc>(*buffer_allocator_.get());
79 return std::make_shared<MessageMemoryStrategy<MessageT, Alloc>>(std::make_shared<Alloc>());
110 return serialized_msg;
132 serialized_msg.
reset();
151 #endif // RCLCPP__MESSAGE_MEMORY_STRATEGY_HPP_ #define rcl_get_error_string
Default allocation strategy for messages received by subscriptions.
Definition: message_memory_strategy.hpp:40
virtual std::shared_ptr< MessageT > borrow_message()
By default, dynamically allocate a new message.
Definition: message_memory_strategy.hpp:84
allocator::Deleter< MessageAlloc, MessageT > MessageDeleter
Definition: message_memory_strategy.hpp:47
allocator::Deleter< BufferAlloc, char > BufferDeleter
Definition: message_memory_strategy.hpp:56
allocator::AllocRebind< rcl_serialized_message_t, std::allocator< void > > SerializedMessageAllocTraits
Definition: message_memory_strategy.hpp:49
typename SerializedMessageAllocTraits::allocator_type SerializedMessageAlloc
Definition: message_memory_strategy.hpp:50
virtual void set_default_buffer_capacity(size_t capacity)
Definition: message_memory_strategy.hpp:118
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
allocator::AllocRebind< char, std::allocator< void > > BufferAllocTraits
Definition: message_memory_strategy.hpp:54
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:125
#define rmw_serialized_message_fini
static SharedPtr create_default()
Default factory method.
Definition: message_memory_strategy.hpp:77
void throw_from_rcl_error(rcl_ret_t ret, const std::string &prefix="", const rcl_error_state_t *error_state=nullptr, void(*reset_error)()=rcl_reset_error)
Throw a C++ std::exception which was created based on an rcl error.
std::shared_ptr< BufferAlloc > buffer_allocator_
Definition: message_memory_strategy.hpp:141
typename std::allocator_traits< Alloc >::template rebind_traits< T > AllocRebind
Definition: allocator_common.hpp:30
virtual std::shared_ptr< rcl_serialized_message_t > borrow_serialized_message(size_t capacity)
Definition: message_memory_strategy.hpp:89
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
BufferDeleter buffer_deleter_
Definition: message_memory_strategy.hpp:142
virtual std::shared_ptr< rcl_serialized_message_t > borrow_serialized_message()
Definition: message_memory_strategy.hpp:113
size_t default_buffer_capacity_
Definition: message_memory_strategy.hpp:143
SerializedMessageDeleter serialized_message_deleter_
Definition: message_memory_strategy.hpp:139
typename BufferAllocTraits::allocator_type BufferAlloc
Definition: message_memory_strategy.hpp:55
#define rmw_get_zero_initialized_serialized_message
#define RCUTILS_LOG_ERROR_NAMED(name,...)
allocator::AllocRebind< MessageT, std::allocator< void > > MessageAllocTraits
Definition: message_memory_strategy.hpp:45
rcutils_allocator_t rcutils_allocator_
Definition: message_memory_strategy.hpp:145
Set the data type used in the intra-process buffer as std::shared_ptr<MessageT>
std::shared_ptr< SerializedMessageAlloc > serialized_message_allocator_
Definition: message_memory_strategy.hpp:138
std::shared_ptr< MessageAlloc > message_allocator_
Definition: message_memory_strategy.hpp:135
MessageDeleter message_deleter_
Definition: message_memory_strategy.hpp:136
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
allocator::Deleter< SerializedMessageAlloc, rcl_serialized_message_t > SerializedMessageDeleter
Definition: message_memory_strategy.hpp:52
MessageMemoryStrategy(std::shared_ptr< Alloc > allocator)
Definition: message_memory_strategy.hpp:66
virtual ~MessageMemoryStrategy()=default
#define rmw_serialized_message_init
virtual void return_serialized_message(std::shared_ptr< rcl_serialized_message_t > &serialized_msg)
Definition: message_memory_strategy.hpp:130
typename MessageAllocTraits::allocator_type MessageAlloc
Definition: message_memory_strategy.hpp:46