rclcpp  master
C++ ROS Client Library API
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc > Class Template Reference

Default allocation strategy for messages received by subscriptions. More...

#include <message_memory_strategy.hpp>

Collaboration diagram for rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >:
Collaboration graph
[legend]

Public Types

using MessageAllocTraits = allocator::AllocRebind< MessageT, Alloc >
 
using MessageAlloc = typename MessageAllocTraits::allocator_type
 
using MessageDeleter = allocator::Deleter< MessageAlloc, MessageT >
 
using SerializedMessageAllocTraits = allocator::AllocRebind< rcl_serialized_message_t, Alloc >
 
using SerializedMessageAlloc = typename SerializedMessageAllocTraits::allocator_type
 
using SerializedMessageDeleter = allocator::Deleter< SerializedMessageAlloc, rcl_serialized_message_t >
 
using BufferAllocTraits = allocator::AllocRebind< char, Alloc >
 
using BufferAlloc = typename BufferAllocTraits::allocator_type
 
using BufferDeleter = allocator::Deleter< BufferAlloc, char >
 

Public Member Functions

 MessageMemoryStrategy ()
 
 MessageMemoryStrategy (std::shared_ptr< Alloc > allocator)
 
virtual ~MessageMemoryStrategy ()=default
 
virtual std::shared_ptr< MessageT > borrow_message ()
 By default, dynamically allocate a new message. More...
 
virtual std::shared_ptr< rcl_serialized_message_tborrow_serialized_message (size_t capacity)
 
virtual std::shared_ptr< rcl_serialized_message_tborrow_serialized_message ()
 
virtual void set_default_buffer_capacity (size_t capacity)
 
virtual void return_message (std::shared_ptr< MessageT > &msg)
 Release ownership of the message, which will deallocate it if it has no more owners. More...
 
virtual void return_serialized_message (std::shared_ptr< rcl_serialized_message_t > &serialized_msg)
 

Static Public Member Functions

static SharedPtr create_default ()
 Default factory method. More...
 

Public Attributes

std::shared_ptr< MessageAllocmessage_allocator_
 
MessageDeleter message_deleter_
 
std::shared_ptr< SerializedMessageAllocserialized_message_allocator_
 
SerializedMessageDeleter serialized_message_deleter_
 
std::shared_ptr< BufferAllocbuffer_allocator_
 
BufferDeleter buffer_deleter_
 
size_t default_buffer_capacity_ = 0
 
rcutils_allocator_t rcutils_allocator_
 

Detailed Description

template<typename MessageT, typename Alloc = std::allocator<void>>
class rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >

Default allocation strategy for messages received by subscriptions.

A message memory strategy must be templated on the type of the subscription it belongs to.

Member Typedef Documentation

◆ MessageAllocTraits

template<typename MessageT, typename Alloc = std::allocator<void>>
using rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::MessageAllocTraits = allocator::AllocRebind<MessageT, Alloc>

◆ MessageAlloc

template<typename MessageT, typename Alloc = std::allocator<void>>
using rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::MessageAlloc = typename MessageAllocTraits::allocator_type

◆ MessageDeleter

template<typename MessageT, typename Alloc = std::allocator<void>>
using rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::MessageDeleter = allocator::Deleter<MessageAlloc, MessageT>

◆ SerializedMessageAllocTraits

template<typename MessageT, typename Alloc = std::allocator<void>>
using rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::SerializedMessageAllocTraits = allocator::AllocRebind<rcl_serialized_message_t, Alloc>

◆ SerializedMessageAlloc

template<typename MessageT, typename Alloc = std::allocator<void>>
using rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::SerializedMessageAlloc = typename SerializedMessageAllocTraits::allocator_type

◆ SerializedMessageDeleter

template<typename MessageT, typename Alloc = std::allocator<void>>
using rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::SerializedMessageDeleter = allocator::Deleter<SerializedMessageAlloc, rcl_serialized_message_t>

◆ BufferAllocTraits

template<typename MessageT, typename Alloc = std::allocator<void>>
using rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::BufferAllocTraits = allocator::AllocRebind<char, Alloc>

◆ BufferAlloc

template<typename MessageT, typename Alloc = std::allocator<void>>
using rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::BufferAlloc = typename BufferAllocTraits::allocator_type

◆ BufferDeleter

template<typename MessageT, typename Alloc = std::allocator<void>>
using rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::BufferDeleter = allocator::Deleter<BufferAlloc, char>

Constructor & Destructor Documentation

◆ MessageMemoryStrategy() [1/2]

template<typename MessageT, typename Alloc = std::allocator<void>>
rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::MessageMemoryStrategy ( )
inline

◆ MessageMemoryStrategy() [2/2]

template<typename MessageT, typename Alloc = std::allocator<void>>
rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::MessageMemoryStrategy ( std::shared_ptr< Alloc >  allocator)
inlineexplicit

◆ ~MessageMemoryStrategy()

template<typename MessageT, typename Alloc = std::allocator<void>>
virtual rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::~MessageMemoryStrategy ( )
virtualdefault

Member Function Documentation

◆ create_default()

template<typename MessageT, typename Alloc = std::allocator<void>>
static SharedPtr rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::create_default ( )
inlinestatic

Default factory method.

◆ borrow_message()

template<typename MessageT, typename Alloc = std::allocator<void>>
virtual std::shared_ptr<MessageT> rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::borrow_message ( )
inlinevirtual

By default, dynamically allocate a new message.

Returns
Shared pointer to the new message.

Reimplemented in rclcpp::strategies::message_pool_memory_strategy::MessagePoolMemoryStrategy< MessageT, Size, >.

◆ borrow_serialized_message() [1/2]

template<typename MessageT, typename Alloc = std::allocator<void>>
virtual std::shared_ptr<rcl_serialized_message_t> rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::borrow_serialized_message ( size_t  capacity)
inlinevirtual

◆ borrow_serialized_message() [2/2]

template<typename MessageT, typename Alloc = std::allocator<void>>
virtual std::shared_ptr<rcl_serialized_message_t> rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::borrow_serialized_message ( )
inlinevirtual

◆ set_default_buffer_capacity()

template<typename MessageT, typename Alloc = std::allocator<void>>
virtual void rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::set_default_buffer_capacity ( size_t  capacity)
inlinevirtual

◆ return_message()

template<typename MessageT, typename Alloc = std::allocator<void>>
virtual void rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::return_message ( std::shared_ptr< MessageT > &  msg)
inlinevirtual

Release ownership of the message, which will deallocate it if it has no more owners.

Parameters
[in]msgShared pointer to the message we are returning.

Reimplemented in rclcpp::strategies::message_pool_memory_strategy::MessagePoolMemoryStrategy< MessageT, Size, >.

◆ return_serialized_message()

template<typename MessageT, typename Alloc = std::allocator<void>>
virtual void rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::return_serialized_message ( std::shared_ptr< rcl_serialized_message_t > &  serialized_msg)
inlinevirtual

Member Data Documentation

◆ message_allocator_

template<typename MessageT, typename Alloc = std::allocator<void>>
std::shared_ptr<MessageAlloc> rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::message_allocator_

◆ message_deleter_

template<typename MessageT, typename Alloc = std::allocator<void>>
MessageDeleter rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::message_deleter_

◆ serialized_message_allocator_

template<typename MessageT, typename Alloc = std::allocator<void>>
std::shared_ptr<SerializedMessageAlloc> rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::serialized_message_allocator_

◆ serialized_message_deleter_

template<typename MessageT, typename Alloc = std::allocator<void>>
SerializedMessageDeleter rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::serialized_message_deleter_

◆ buffer_allocator_

template<typename MessageT, typename Alloc = std::allocator<void>>
std::shared_ptr<BufferAlloc> rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::buffer_allocator_

◆ buffer_deleter_

template<typename MessageT, typename Alloc = std::allocator<void>>
BufferDeleter rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::buffer_deleter_

◆ default_buffer_capacity_

template<typename MessageT, typename Alloc = std::allocator<void>>
size_t rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::default_buffer_capacity_ = 0

◆ rcutils_allocator_

template<typename MessageT, typename Alloc = std::allocator<void>>
rcutils_allocator_t rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::rcutils_allocator_

The documentation for this class was generated from the following file: