------------------------------------------------------------------------------
| 710 | |
| 711 | //------------------------------------------------------------------------------ |
| 712 | int vtkDataAssembly::FindOrCreateNodeAtPath(const char* path, int parent) |
| 713 | { |
| 714 | if (!path || !path[0]) |
| 715 | { |
| 716 | // An empty/invalid path returns the "root" node. |
| 717 | return parent; |
| 718 | } |
| 719 | |
| 720 | auto it = this->Internals->NodeMap.find(parent); |
| 721 | if (it == this->Internals->NodeMap.end()) |
| 722 | { |
| 723 | return -1; |
| 724 | } |
| 725 | |
| 726 | // The parent node exists. |
| 727 | int node = parent; |
| 728 | auto pathNames = vtksys::SystemTools::SplitString(path, '/'); |
| 729 | for (std::size_t ii = 0; ii < pathNames.size(); ++ii) |
| 730 | { |
| 731 | std::string childName = pathNames[ii]; |
| 732 | auto children = this->GetChildNodes(node, /*traverse_subtree*/ false, /*traversal_order*/ 0); |
| 733 | bool foundChild = false; |
| 734 | for (const auto& child : children) |
| 735 | { |
| 736 | it = this->Internals->NodeMap.find(child); |
| 737 | if (it == this->Internals->NodeMap.end()) |
| 738 | { |
| 739 | // Inconsistent node map! |
| 740 | return -1; |
| 741 | } |
| 742 | if (it->second.name() == childName) |
| 743 | { |
| 744 | node = child; |
| 745 | foundChild = true; |
| 746 | break; |
| 747 | } |
| 748 | } |
| 749 | if (!foundChild) |
| 750 | { |
| 751 | // Create all remaining entries |
| 752 | for (; ii < pathNames.size(); ++ii) |
| 753 | { |
| 754 | childName = pathNames[ii]; |
| 755 | node = this->AddNode(childName.c_str(), node); |
| 756 | } |
| 757 | return node; |
| 758 | } |
| 759 | } |
| 760 | return node; |
| 761 | } |
| 762 | |
| 763 | //------------------------------------------------------------------------------ |
| 764 | bool vtkDataAssembly::AddDataSetIndex(int id, unsigned int dataset_index) |
nothing calls this directly
no test coverage detected