Extended NetlistCrossReference class so we can easily obtain the other_... objects.

This commit is contained in:
Matthias Koefferlein 2020-06-15 01:27:33 +02:00
parent 84a9853435
commit 3f1c3cf209
3 changed files with 64 additions and 0 deletions

View File

@ -55,6 +55,39 @@ NetlistCrossReference::per_circuit_data_for (const std::pair<const db::Circuit *
return 0;
}
const db::Pin *
NetlistCrossReference::other_pin_for (const db::Pin *pin) const
{
std::map<const db::Pin *, const db::Pin *>::const_iterator i = m_other_pin.find (pin);
if (i != m_other_pin.end ()) {
return i->second;
} else {
return 0;
}
}
const db::Device *
NetlistCrossReference::other_device_for (const db::Device *device) const
{
std::map<const db::Device *, const db::Device *>::const_iterator i = m_other_device.find (device);
if (i != m_other_device.end ()) {
return i->second;
} else {
return 0;
}
}
const db::SubCircuit *
NetlistCrossReference::other_subcircuit_for (const db::SubCircuit *subcircuit) const
{
std::map<const db::SubCircuit *, const db::SubCircuit *>::const_iterator i = m_other_subcircuit.find (subcircuit);
if (i != m_other_subcircuit.end ()) {
return i->second;
} else {
return 0;
}
}
const db::Circuit *
NetlistCrossReference::other_circuit_for (const db::Circuit *circuit) const
{

View File

@ -256,6 +256,9 @@ public:
return m_circuits.end ();
}
const db::Pin *other_pin_for (const db::Pin *pin) const;
const db::Device *other_device_for (const db::Device *device) const;
const db::SubCircuit *other_subcircuit_for (const db::SubCircuit *subcircuit) const;
const db::Circuit *other_circuit_for (const db::Circuit *circuit) const;
const db::Net *other_net_for (const db::Net *net) const;
const PerNetData *per_net_data_for (const std::pair<const db::Net *, const db::Net *> &nets) const;

View File

@ -403,6 +403,34 @@ Class<db::NetlistCrossReference> decl_dbNetlistCrossReference (decl_dbNetlistCom
"The return value will be nil if no match is found. "
"Otherwise it is the 'b' net for nets from the 'a' netlist and vice versa."
) +
gsi::method ("other_circuit_for", &db::NetlistCrossReference::other_circuit_for, gsi::arg ("circuit"),
"@brief Gets the matching other circuit for a given primary circuit.\n"
"The return value will be nil if no match is found. "
"Otherwise it is the 'b' circuit for circuits from the 'a' netlist and vice versa."
"\n\n"
"This method has been introduced in version 0.27.\n"
) +
gsi::method ("other_device_for", &db::NetlistCrossReference::other_device_for, gsi::arg ("device"),
"@brief Gets the matching other device for a given primary device.\n"
"The return value will be nil if no match is found. "
"Otherwise it is the 'b' device for devices from the 'a' netlist and vice versa."
"\n\n"
"This method has been introduced in version 0.27.\n"
) +
gsi::method ("other_pin_for", &db::NetlistCrossReference::other_pin_for, gsi::arg ("pin"),
"@brief Gets the matching other pin for a given primary pin.\n"
"The return value will be nil if no match is found. "
"Otherwise it is the 'b' pin for pins from the 'a' netlist and vice versa."
"\n\n"
"This method has been introduced in version 0.27.\n"
) +
gsi::method ("other_subcircuit_for", &db::NetlistCrossReference::other_subcircuit_for, gsi::arg ("subcircuit"),
"@brief Gets the matching other subcircuit for a given primary subcircuit.\n"
"The return value will be nil if no match is found. "
"Otherwise it is the 'b' subcircuit for subcircuits from the 'a' netlist and vice versa."
"\n\n"
"This method has been introduced in version 0.27.\n"
) +
gsi::method ("clear", &db::NetlistCrossReference::clear,
"@hide\n"
) +