| 536 | |
| 537 | |
| 538 | void PipelineManager::replace(Stage *sOld, Stage *sNew) |
| 539 | { |
| 540 | Utils::remove(m_stages, sNew); |
| 541 | for (Stage * & s : m_stages) |
| 542 | { |
| 543 | if (s == sOld) |
| 544 | { |
| 545 | s = sNew; |
| 546 | // Copy inputs from the old stage to new one. |
| 547 | for (Stage *ss : sOld->getInputs()) |
| 548 | sNew->setInput(*ss); |
| 549 | } |
| 550 | // Reset the inputs that refer to the replaced stage. |
| 551 | for (Stage * & ss : s->getInputs()) |
| 552 | if (ss == sOld) |
| 553 | ss = sNew; |
| 554 | } |
| 555 | } |
| 556 | |
| 557 | void PipelineManager::destroyStage(Stage *s) |
| 558 | { |