------------------------------------------------------------------------------
| 615 | |
| 616 | //------------------------------------------------------------------------------ |
| 617 | void vtkExecutive::CopyDefaultInformation(vtkInformation* request, int direction, |
| 618 | vtkInformationVector** inInfoVec, vtkInformationVector* outInfoVec) |
| 619 | { |
| 620 | if (direction == vtkExecutive::RequestDownstream) |
| 621 | { |
| 622 | // Copy information from the first input to all outputs. |
| 623 | if (this->GetNumberOfInputPorts() > 0 && inInfoVec[0]->GetNumberOfInformationObjects() > 0) |
| 624 | { |
| 625 | vtkInformationKey** keys = request->Get(KEYS_TO_COPY()); |
| 626 | int length = request->Length(KEYS_TO_COPY()); |
| 627 | vtkInformation* inInfo = inInfoVec[0]->GetInformationObject(0); |
| 628 | |
| 629 | vtkSmartPointer<vtkInformationIterator> infoIter = |
| 630 | vtkSmartPointer<vtkInformationIterator>::New(); |
| 631 | infoIter->SetInformationWeak(inInfo); |
| 632 | |
| 633 | int oiobj = outInfoVec->GetNumberOfInformationObjects(); |
| 634 | for (int i = 0; i < oiobj; ++i) |
| 635 | { |
| 636 | vtkInformation* outInfo = outInfoVec->GetInformationObject(i); |
| 637 | for (int j = 0; j < length; ++j) |
| 638 | { |
| 639 | // Copy the entry. |
| 640 | outInfo->CopyEntry(inInfo, keys[j]); |
| 641 | |
| 642 | // If the entry is a key vector, copy all the keys listed. |
| 643 | if (vtkInformationKeyVectorKey* vkey = vtkInformationKeyVectorKey::SafeDownCast(keys[j])) |
| 644 | { |
| 645 | outInfo->CopyEntries(inInfo, vkey); |
| 646 | } |
| 647 | } |
| 648 | |
| 649 | // Give the keys an opportunity to copy themselves. |
| 650 | infoIter->InitTraversal(); |
| 651 | while (!infoIter->IsDoneWithTraversal()) |
| 652 | { |
| 653 | vtkInformationKey* key = infoIter->GetCurrentKey(); |
| 654 | key->CopyDefaultInformation(request, inInfo, outInfo); |
| 655 | infoIter->GoToNextItem(); |
| 656 | } |
| 657 | } |
| 658 | } |
| 659 | } |
| 660 | else |
| 661 | { |
| 662 | // Get the output port from which the request was made. Use zero |
| 663 | // if output port was not specified. |
| 664 | int outputPort = 0; |
| 665 | if (request->Has(FROM_OUTPUT_PORT())) |
| 666 | { |
| 667 | outputPort = request->Get(FROM_OUTPUT_PORT()); |
| 668 | outputPort = outputPort == -1 ? 0 : outputPort; |
| 669 | } |
| 670 | |
| 671 | // Copy information from the requesting output to all inputs. |
| 672 | if (outputPort >= 0 && outputPort < outInfoVec->GetNumberOfInformationObjects()) |
| 673 | { |
| 674 | vtkInformationKey** keys = request->Get(KEYS_TO_COPY()); |
no test coverage detected