| 380 | */ |
| 381 | template <class DerivedT, typename... ExtraArgs> |
| 382 | static std::unique_ptr<TreeNode> Instantiate(const std::string& name, |
| 383 | const NodeConfig& config, |
| 384 | ExtraArgs... args) |
| 385 | { |
| 386 | static_assert(hasNodeFullCtor<DerivedT, ExtraArgs...>() || |
| 387 | hasNodeNameCtor<DerivedT>()); |
| 388 | |
| 389 | if constexpr(hasNodeFullCtor<DerivedT, ExtraArgs...>()) |
| 390 | { |
| 391 | return std::make_unique<DerivedT>(name, config, args...); |
| 392 | } |
| 393 | else if constexpr(hasNodeNameCtor<DerivedT>()) |
| 394 | { |
| 395 | auto node_ptr = std::make_unique<DerivedT>(name, args...); |
| 396 | node_ptr->config() = config; |
| 397 | return node_ptr; |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | protected: |
| 402 | friend class BehaviorTreeFactory; |
nothing calls this directly
no outgoing calls
no test coverage detected