------------------------------------------------------------------------------
| 1484 | |
| 1485 | //------------------------------------------------------------------------------ |
| 1486 | void vtkAlgorithm::SetNumberOfInputConnections(int port, int n) |
| 1487 | { |
| 1488 | // Get the consumer executive and port number. |
| 1489 | vtkExecutive* consumer = this->GetExecutive(); |
| 1490 | int consumerPort = port; |
| 1491 | |
| 1492 | // Get the vector of connected input information objects. |
| 1493 | vtkInformationVector* inputs = consumer->GetInputInformation(consumerPort); |
| 1494 | |
| 1495 | // If the number of connections has not changed, do nothing. |
| 1496 | if (n == inputs->GetNumberOfInformationObjects()) |
| 1497 | { |
| 1498 | return; |
| 1499 | } |
| 1500 | |
| 1501 | // Remove connections beyond the new number. |
| 1502 | for (int i = n; i < inputs->GetNumberOfInformationObjects(); ++i) |
| 1503 | { |
| 1504 | // Remove each input's reference to this consumer. |
| 1505 | if (vtkInformation* oldInfo = inputs->GetInformationObject(i)) |
| 1506 | { |
| 1507 | vtkExecutive::CONSUMERS()->Remove(oldInfo, consumer, consumerPort); |
| 1508 | } |
| 1509 | } |
| 1510 | |
| 1511 | // Set the number of connected inputs. Non-existing inputs will be |
| 1512 | // empty information objects. |
| 1513 | inputs->SetNumberOfInformationObjects(n); |
| 1514 | |
| 1515 | // This algorithm has been modified. |
| 1516 | this->Modified(); |
| 1517 | } |
| 1518 | |
| 1519 | //------------------------------------------------------------------------------ |
| 1520 | vtkAlgorithmOutput* vtkAlgorithm::GetOutputPort(int port) |
no test coverage detected