15 #ifndef RCLCPP__STRATEGIES__MESSAGE_POOL_MEMORY_STRATEGY_HPP_ 16 #define RCLCPP__STRATEGIES__MESSAGE_POOL_MEMORY_STRATEGY_HPP_ 28 namespace message_pool_memory_strategy
42 rosidl_generator_traits::has_fixed_size<MessageT>::value
55 for (
size_t i = 0; i < Size; ++i) {
56 pool_[i].msg_ptr_ = std::make_shared<MessageT>();
57 pool_[i].used =
false;
71 if (
pool_[current_index].used) {
74 pool_[current_index].msg_ptr_->~MessageT();
75 new (
pool_[current_index].msg_ptr_.get())MessageT;
77 pool_[current_index].used =
true;
78 return pool_[current_index].msg_ptr_;
88 for (
size_t i = 0; i < Size; ++i) {
89 if (
pool_[i].msg_ptr_ == msg) {
90 pool_[i].used =
false;
112 #endif // RCLCPP__STRATEGIES__MESSAGE_POOL_MEMORY_STRATEGY_HPP_ Default allocation strategy for messages received by subscriptions.
Definition: message_memory_strategy.hpp:40
std::shared_ptr< MessageT > msg_ptr_
Definition: message_pool_memory_strategy.hpp:100
Definition: message_pool_memory_strategy.hpp:98
Definition: allocator_common.hpp:24
std::array< PoolMember, Size > pool_
Definition: message_pool_memory_strategy.hpp:104
void return_message(std::shared_ptr< MessageT > &msg)
Return a message to the message pool.
Definition: message_pool_memory_strategy.hpp:86
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
Completely static memory allocation strategy for messages.
Definition: message_pool_memory_strategy.hpp:45
size_t next_array_index_
Definition: message_pool_memory_strategy.hpp:105
bool used
Definition: message_pool_memory_strategy.hpp:101
std::shared_ptr< MessageT > borrow_message()
Borrow a message from the message pool.
Definition: message_pool_memory_strategy.hpp:67