Template Class MessagePoolMemoryStrategy
Defined in File message_pool_memory_strategy.hpp
Nested Relationships
Nested Types
Inheritance Relationships
Base Type
public rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT >
(Template Class MessageMemoryStrategy)
Class Documentation
-
template<typename MessageT, size_t Size, typename std::enable_if<rosidl_generator_traits::has_fixed_size<MessageT>::value>::type* = nullptr>
class MessagePoolMemoryStrategy : public rclcpp::message_memory_strategy::MessageMemoryStrategy<MessageT> Completely static memory allocation strategy for messages.
Templated on the type of message pooled by this class and the size of the message pool. Templating allows the program to determine the memory required for this object at compile time. The size of the message pool should be at least the largest number of concurrent accesses to the subscription (usually the number of threads).
Public Functions
-
inline MessagePoolMemoryStrategy()
-
inline virtual std::shared_ptr<MessageT> borrow_message()
Borrow a message from the message pool.
Manage the message pool ring buffer. Throw an exception if the next message was not available.
- Returns:
Shared pointer to the borrowed message.
Return a message to the message pool.
This does nothing since the message isn’t returned to the pool until the user has dropped all references.
- Parameters:
msg – [in] Shared pointer to the message to return.
Protected Attributes
-
std::shared_ptr<std::mutex> pool_mutex_
-
std::shared_ptr<CircularArray<Size>> free_list_
-
template<size_t N>
class CircularArray
-
inline MessagePoolMemoryStrategy()