15 #ifndef RCLCPP__MESSAGE_MEMORY_STRATEGY_HPP_ 16 #define RCLCPP__MESSAGE_MEMORY_STRATEGY_HPP_ 32 namespace message_memory_strategy
37 template<
typename MessageT,
typename Alloc = std::allocator<
void>>
75 return std::make_shared<MessageMemoryStrategy<MessageT, Alloc>>(std::make_shared<Alloc>());
103 return serialized_msg;
125 serialized_msg.
reset();
144 #endif // RCLCPP__MESSAGE_MEMORY_STRATEGY_HPP_
static SharedPtr create_default()
Default factory method.
Definition: message_memory_strategy.hpp:73
virtual void return_serialized_message(std::shared_ptr< rcl_serialized_message_t > &serialized_msg)
Definition: message_memory_strategy.hpp:123
size_t default_buffer_capacity_
Definition: message_memory_strategy.hpp:136
rmw_ret_t rmw_serialized_message_fini(rmw_serialized_message_t *msg)
allocator::AllocRebind< char, std::allocator< void > > BufferAllocTraits
Definition: message_memory_strategy.hpp:52
Definition: allocator_common.hpp:24
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:118
std::shared_ptr< MessageAlloc > message_allocator_
Definition: message_memory_strategy.hpp:128
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:134
std::shared_ptr< SerializedMessageAlloc > serialized_message_allocator_
Definition: message_memory_strategy.hpp:131
typename std::allocator_traits< Alloc >::template rebind_traits< T > AllocRebind
Definition: allocator_common.hpp:30
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
virtual std::shared_ptr< rcl_serialized_message_t > borrow_serialized_message()
Definition: message_memory_strategy.hpp:106
rmw_ret_t rmw_serialized_message_init(rmw_serialized_message_t *msg, size_t buffer_capacity, const rcutils_allocator_t *allocator)
typename BufferAllocTraits::allocator_type BufferAlloc
Definition: message_memory_strategy.hpp:53
allocator::AllocRebind< rcl_serialized_message_t, std::allocator< void > > SerializedMessageAllocTraits
Definition: message_memory_strategy.hpp:47
allocator::Deleter< SerializedMessageAlloc, rcl_serialized_message_t > SerializedMessageDeleter
Definition: message_memory_strategy.hpp:50
allocator::AllocRebind< MessageT, std::allocator< void > > MessageAllocTraits
Definition: message_memory_strategy.hpp:43
rcutils_allocator_t rcutils_allocator_
Definition: message_memory_strategy.hpp:138
Default allocation strategy for messages received by subscriptions.
Definition: message_memory_strategy.hpp:38
SerializedMessageDeleter serialized_message_deleter_
Definition: message_memory_strategy.hpp:132
MessageMemoryStrategy(std::shared_ptr< Alloc > allocator)
Definition: message_memory_strategy.hpp:64
allocator::Deleter< MessageAlloc, MessageT > MessageDeleter
Definition: message_memory_strategy.hpp:45
BufferDeleter buffer_deleter_
Definition: message_memory_strategy.hpp:135
typename MessageAllocTraits::allocator_type MessageAlloc
Definition: message_memory_strategy.hpp:44
typename SerializedMessageAllocTraits::allocator_type SerializedMessageAlloc
Definition: message_memory_strategy.hpp:48
virtual std::shared_ptr< rcl_serialized_message_t > borrow_serialized_message(size_t capacity)
Definition: message_memory_strategy.hpp:85
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 std::shared_ptr< MessageT > borrow_message()
By default, dynamically allocate a new message.
Definition: message_memory_strategy.hpp:80
MessageDeleter message_deleter_
Definition: message_memory_strategy.hpp:129
allocator::Deleter< BufferAlloc, char > BufferDeleter
Definition: message_memory_strategy.hpp:54
rmw_serialized_message_t rmw_get_zero_initialized_serialized_message(void)
virtual void set_default_buffer_capacity(size_t capacity)
Definition: message_memory_strategy.hpp:111