static factory method
This commit is contained in:
parent
06818ee78c
commit
0e78ea0512
3 changed files with 5 additions and 5 deletions
|
@ -31,10 +31,10 @@ using rclcpp::memory_strategies::allocator_memory_strategy::AllocatorMemoryStrat
|
|||
} /* memory_strategies */
|
||||
|
||||
namespace memory_strategy {
|
||||
MemoryStrategy::SharedPtr create_default_strategy() {
|
||||
static MemoryStrategy::SharedPtr create_default_strategy() {
|
||||
return std::make_shared<memory_strategies::allocator_memory_strategy::AllocatorMemoryStrategy<>>();
|
||||
}
|
||||
}
|
||||
} /* memory_strategy */
|
||||
|
||||
} /* rclcpp */
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class MemoryStrategy
|
|||
{
|
||||
public:
|
||||
RCLCPP_SMART_PTR_DEFINITIONS_NOT_COPYABLE(MemoryStrategy);
|
||||
using WeakNodeVector = std::vector<std::weak_ptr<rclcpp::node::Node>>>;
|
||||
using WeakNodeVector = typename std::vector<std::weak_ptr<rclcpp::node::Node>>>;
|
||||
|
||||
// return the new number of subscribers
|
||||
virtual size_t fill_subscriber_handles(void ** ptr) = 0;
|
||||
|
|
|
@ -43,8 +43,6 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy
|
|||
public:
|
||||
RCLCPP_SMART_PTR_DEFINITIONS(AllocatorMemoryStrategy<Alloc>);
|
||||
|
||||
using WeakNode = std::weak_ptr<rclcpp::node::Node>>;
|
||||
using NodeVector = std::vector<WeakNode>;
|
||||
|
||||
using ExecAllocTraits = allocator::AllocRebind<executor::AnyExecutable, Alloc>;
|
||||
using ExecAlloc = typename ExecAllocTraits::allocator_type;
|
||||
|
@ -52,6 +50,8 @@ public:
|
|||
using VoidAllocTraits = typename allocator::AllocRebind<void *, Alloc>;
|
||||
using VoidAlloc = typename VoidAllocTraits::allocator_type;
|
||||
|
||||
using NodeVector = typename std::vector<std::weak_ptr<rclcpp::node::Node>>>;
|
||||
|
||||
AllocatorMemoryStrategy(std::shared_ptr<Alloc> allocator)
|
||||
{
|
||||
executable_allocator_ = std::make_shared<ExecAlloc>(*allocator.get());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue