MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / Instantiate

Method Instantiate

include/behaviortree_cpp/tree_node.h:382–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
401protected:
402 friend class BehaviorTreeFactory;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected