| 792 | } |
| 793 | |
| 794 | void ImportTreeFromJSON(const nlohmann::json& json, Tree& tree) |
| 795 | { |
| 796 | if(json.size() != tree.subtrees.size()) |
| 797 | { |
| 798 | throw std::runtime_error("Number of blackboards don't match:"); |
| 799 | } |
| 800 | |
| 801 | size_t index = 0; |
| 802 | for(const auto& [key, array] : json.items()) |
| 803 | { |
| 804 | auto& subtree = tree.subtrees.at(index++); |
| 805 | ImportBlackboardFromJSON(array, *subtree->blackboard); |
| 806 | } |
| 807 | } |
| 808 | |
| 809 | } // namespace BT |
no test coverage detected