MCPcopy Create free account
hub / github.com/ImageEngine/cortex / removePathsWalk

Method removePathsWalk

src/IECore/PathMatcher.cpp:719–750  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

717}
718
719PathMatcher::NodePtr PathMatcher::removePathsWalk( Node *node, const Node *srcNode, bool shared, bool &removed )
720{
721 shared = shared || node->refCount() > 1;
722 NodePtr result;
723
724 if( node->terminator && srcNode->terminator )
725 {
726 writable( node, result, shared )->terminator = false;
727 removed = true;
728 }
729
730 for( Node::ChildMap::const_iterator it = srcNode->children.begin(), eIt = srcNode->children.end(); it != eIt; ++it )
731 {
732 const Node::ChildMapIterator childIt = node->children.find( it->first );
733 if( childIt != node->children.end() )
734 {
735 Node *child = childIt->second.get();
736 NodePtr newChild = removePathsWalk( child, it->second.get(), shared, removed );
737
738 if( newChild && !newChild->isEmpty() )
739 {
740 writable( node, result, shared )->children[childIt->first] = newChild;
741 }
742 else if( child->isEmpty() || ( newChild && newChild->isEmpty() ) )
743 {
744 writable( node, result, shared )->children.erase( childIt->first );
745 }
746 }
747 }
748
749 return result;
750}
751
752namespace
753{

Callers

nothing calls this directly

Calls 6

beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45
getMethod · 0.45
isEmptyMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected