Removing a Net from a Circuit leaves InstancePins attached to the associated Instance yet the parent pointer of the InstancePin is now reset. If the intended behavior is to leave behind the InstancePins on Net removal, then this is not a bug. However, the unconnected InstancePin has no reflection in the resulting XDL.
The removeSource and removeSink functions in the Net remove the InstancePin from the Instance, but removing the Net from the Circuit does not call the pin removal methods and then leaves the InstancePins on the Instance. It seems like the removeNet function should include iterating over the source and sink pins removing them from their respective instances.
The following code demonstrates the InstancePin left after Net removal:
DesignSharedPtr design = torc::physical::Factory::newDesignPtr(
"design", "device", "", "-1", "v1.0");
InstanceSharedPtr instance = Factory::newInstancePtr("instance", "type", "", "");
InstancePinSharedPtr pin = Factory::newInstancePinPtr(instance, "pin");
NetSharedPtr net = torc::physical::Factory::newNetPtr("net");
net->addSource(pin);
design->addNet(net);
design->addInstance(instance);
design->removeNet(net);
cout << "Instance pin count: " << instance->getPinCount() << endl;
cout << "Pin name is: " << (*(instance->pinsBegin())).first << endl;
InstancePinSharedPtr pin2 = (*instance->pinsBegin()).second;
net.reset();
if (pin2->getParentWeakPtr().expired()) cout << "Pin parent expired!" << endl;