| 504 | } |
| 505 | |
| 506 | void SubgraphView::UpdateSubgraphViewSlotPointers(SubgraphView& patternSubgraph, |
| 507 | const SubgraphView& substituteSubgraph) |
| 508 | { |
| 509 | std::vector<IInputSlot*>::iterator inputSlotPosition; |
| 510 | // search for and erase any InputSlots that appear in the WorkingCopy that match those in the PatternSubgraph |
| 511 | for (unsigned long idx = 0; idx < patternSubgraph.GetIInputSlots().size(); idx++) |
| 512 | { |
| 513 | IInputSlot *slot = patternSubgraph.GetIInputSlots()[idx]; |
| 514 | inputSlotPosition = std::find(m_IInputSlots.begin(), m_IInputSlots.end(), slot); |
| 515 | if (inputSlotPosition != m_IInputSlots.end()) |
| 516 | { |
| 517 | m_IInputSlots.erase(inputSlotPosition); |
| 518 | |
| 519 | // while here, with correct position, add in replacement InputSlot from the substituteSubgraph |
| 520 | m_IInputSlots.insert(inputSlotPosition, substituteSubgraph.GetIInputSlots()[idx]); |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | std::vector<IOutputSlot*>::iterator outputSlotPosition; |
| 525 | // search for and erase any OutputSlots that appear in the WorkingCopy that match those in the PatternSubgraph |
| 526 | for (unsigned long idx = 0; idx < patternSubgraph.GetIOutputSlots().size(); idx++) |
| 527 | { |
| 528 | IOutputSlot *slot = patternSubgraph.GetIOutputSlots()[idx]; |
| 529 | outputSlotPosition = std::find(m_IOutputSlots.begin(), m_IOutputSlots.end(), slot); |
| 530 | if (outputSlotPosition != m_IOutputSlots.end()) |
| 531 | { |
| 532 | m_IOutputSlots.erase(outputSlotPosition); |
| 533 | |
| 534 | // while here, with correct position, add in replacement OutputSlot from the substituteSubgraph |
| 535 | m_IOutputSlots.insert(outputSlotPosition, substituteSubgraph.GetIOutputSlots()[idx]); |
| 536 | } |
| 537 | } |
| 538 | } |
| 539 | |
| 540 | void SubgraphView::SubstituteSubgraph(SubgraphView& patternSubgraph, const SubgraphView& substituteSubgraph) |
| 541 | { |