ROS 2 rclcpp + rcl - humble  humble
ROS 2 C++ Client Library with ROS Client Library
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 <rclcpp/message_memory_strategy.hpp>

Inheritance diagram for rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >:
Inheritance 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< rclcpp::SerializedMessage, Alloc >
 
using SerializedMessageAlloc = typename SerializedMessageAllocTraits::allocator_type
 
using SerializedMessageDeleter = allocator::Deleter< SerializedMessageAlloc, rclcpp::SerializedMessage >
 
using BufferAllocTraits = allocator::AllocRebind< char, Alloc >
 
using BufferAlloc = typename BufferAllocTraits::allocator_type
 
using BufferDeleter = allocator::Deleter< BufferAlloc, char >
 

Public Member Functions

 MessageMemoryStrategy (std::shared_ptr< Alloc > allocator)
 
virtual std::shared_ptr< MessageT > borrow_message ()
 By default, dynamically allocate a new message. More...
 
virtual std::shared_ptr< rclcpp::SerializedMessageborrow_serialized_message (size_t capacity)
 
virtual std::shared_ptr< rclcpp::SerializedMessageborrow_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< rclcpp::SerializedMessage > &serialized_msg)
 

Static Public Member Functions

static SharedPtr create_default ()
 Default factory method.
 

Public Attributes

std::shared_ptr< MessageAlloc > message_allocator_
 
MessageDeleter message_deleter_
 
std::shared_ptr< SerializedMessageAlloc > serialized_message_allocator_
 
SerializedMessageDeleter serialized_message_deleter_
 
std::shared_ptr< BufferAlloc > buffer_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.

Definition at line 41 of file message_memory_strategy.hpp.

Member Function Documentation

◆ 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, >.

Definition at line 85 of file message_memory_strategy.hpp.

◆ 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, >.

Definition at line 107 of file message_memory_strategy.hpp.


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