| 229 | } |
| 230 | |
| 231 | CompositeNode BehaviorDatabase::compositeNode(Json const& config, StringMap<NodeParameter> parameters, StringMap<NodeParameterValue> const& treeParameters, BehaviorTree& tree) const { |
| 232 | List<BehaviorNodeConstPtr> children = config.getArray("children", {}).transformed([this,treeParameters,&tree](Json const& child) { |
| 233 | return behaviorNode(child, treeParameters, tree); |
| 234 | }); |
| 235 | |
| 236 | CompositeType type = CompositeTypeNames.getLeft(config.getString("name")); |
| 237 | if (type == CompositeType::Sequence) |
| 238 | return SequenceNode(children); |
| 239 | else if (type == CompositeType::Selector) |
| 240 | return SelectorNode(children); |
| 241 | else if (type == CompositeType::Parallel) |
| 242 | return ParallelNode(parameters, children); |
| 243 | else if (type == CompositeType::Dynamic) |
| 244 | return DynamicNode(children); |
| 245 | else if (type == CompositeType::Randomize) |
| 246 | return RandomizeNode(children); |
| 247 | |
| 248 | // above statement needs to be exhaustive |
| 249 | throw StarException(strf("Composite node type '{}' could not be created from JSON", CompositeTypeNames.getRight(type))); |
| 250 | } |
| 251 | |
| 252 | BehaviorNodeConstPtr BehaviorDatabase::behaviorNode(Json const& json, StringMap<NodeParameterValue> const& treeParameters, BehaviorTree& tree) const { |
| 253 | BehaviorNodeType type = BehaviorNodeTypeNames.getLeft(json.getString("type")); |
nothing calls this directly
no test coverage detected