Merge branch 'dvb' into dvb_test

This commit is contained in:
Matthias Koefferlein 2019-07-12 17:44:11 +02:00
commit f66b094e88
4 changed files with 19 additions and 0 deletions

View File

@ -164,6 +164,13 @@ const Pin *Circuit::pin_by_id (size_t id) const
}
}
void Circuit::rename_pin (size_t id, const std::string &name)
{
if (id < m_pins.size ()) {
m_pins [id].set_name (name);
}
}
const Pin *Circuit::pin_by_name (const std::string &name) const
{
for (Circuit::const_pin_iterator p = begin_pins (); p != end_pins (); ++p) {

View File

@ -678,6 +678,11 @@ public:
*/
void connect_pin (size_t pin_id, Net *net);
/**
* @brief Renames the pin with the given ID
*/
void rename_pin (size_t pin_id, const std::string &name);
/**
* @brief Purge unused nets
*

View File

@ -808,6 +808,8 @@ void NetlistSpiceReader::read_circuit (tl::Extractor &ex, const std::string &nc)
for (std::vector<std::string>::const_iterator i = nn.begin (); i != nn.end (); ++i) {
db::Net *net = make_net (*i);
// use the net name to name the pin (otherwise SPICE pins are always unnamed)
// @@@ mp_circuit->rename_pin (i - nn.begin (), net->name ());
mp_circuit->connect_pin (i - nn.begin (), net);
}

View File

@ -80,6 +80,11 @@ private:
{
m_id = id;
}
void set_name (const std::string &name)
{
m_name = name;
}
};
}