MCPcopy Create free account
hub / github.com/Kitware/VTK / RemoveInputConnection

Method RemoveInputConnection

Common/ExecutionModel/vtkAlgorithm.cxx:1339–1387  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1337
1338//------------------------------------------------------------------------------
1339void vtkAlgorithm::RemoveInputConnection(int port, int idx)
1340{
1341 if (!this->InputPortIndexInRange(port, "disconnect"))
1342 {
1343 return;
1344 }
1345
1346 vtkAlgorithmOutput* input = this->GetInputConnection(port, idx);
1347 if (input)
1348 {
1349 // We need to check if this connection exists multiple times.
1350 // If it does, we can't remove this from the consumers list.
1351 int numConnections = 0;
1352 int numInputConnections = this->GetNumberOfInputConnections(0);
1353 for (int i = 0; i < numInputConnections; i++)
1354 {
1355 if (input == this->GetInputConnection(port, i))
1356 {
1357 numConnections++;
1358 }
1359 }
1360
1361 vtkExecutive* consumer = this->GetExecutive();
1362 int consumerPort = port;
1363
1364 // Get the vector of connected input information objects.
1365 vtkInformationVector* inputs = consumer->GetInputInformation(consumerPort);
1366
1367 // Get the producer/consumer pair for the connection.
1368 vtkExecutive* producer = input->GetProducer()->GetExecutive();
1369 int producerPort = input->GetIndex();
1370
1371 // Get the information object from the producer of the old input.
1372 vtkInformation* oldInfo = producer->GetOutputInformation(producerPort);
1373
1374 // Only connected once, remove this from inputs consumer list.
1375 if (numConnections == 1)
1376 {
1377 // Remove this consumer from the old input's list of consumers.
1378 vtkExecutive::CONSUMERS()->Remove(oldInfo, consumer, consumerPort);
1379 }
1380
1381 // Remove the information object from the list of inputs.
1382 inputs->Remove(idx);
1383
1384 // This algorithm has been modified.
1385 this->Modified();
1386 }
1387}
1388
1389//------------------------------------------------------------------------------
1390void vtkAlgorithm::RemoveInputConnection(int port, vtkAlgorithmOutput* input)

Callers 9

RemoveLabelsMethod · 0.45
RemoveInputDataMethod · 0.45
RemoveInputDataMethod · 0.45
RemoveInputDataMethod · 0.45
RemoveInputDataMethod · 0.45

Calls 12

InputPortIndexInRangeMethod · 0.95
GetInputConnectionMethod · 0.95
GetExecutiveMethod · 0.95
GetProducerMethod · 0.80
GetAlgorithmMethod · 0.80
GetInputInformationMethod · 0.45
GetIndexMethod · 0.45
GetOutputInformationMethod · 0.45
RemoveMethod · 0.45
ModifiedMethod · 0.45
GetObjectDescriptionMethod · 0.45

Tested by

no test coverage detected