mirror of https://github.com/KLayout/klayout.git
Fixing build issues
This commit is contained in:
parent
cb96b8c169
commit
cd942db09a
|
|
@ -215,7 +215,7 @@ void Device::set_parameter_value (const std::string &name, const tl::Variant &v)
|
|||
void Device::set_parameter_value_create (const std::string &name, const tl::Variant &v, bool primary, const tl::Variant &def_value)
|
||||
{
|
||||
if (device_class ()) {
|
||||
set_parameter_value (device_class ()->parameter_id_for_name_create (name, primary, def_value), v);
|
||||
set_parameter_value (mp_device_class->parameter_id_for_name_create (name, primary, def_value), v);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -308,6 +308,27 @@ size_t DeviceClass::parameter_id_for_name (const std::string &name) const
|
|||
throw tl::Exception (tl::to_string (tr ("Invalid parameter name")) + ": '" + name + "'");
|
||||
}
|
||||
|
||||
size_t DeviceClass::parameter_id_for_name_create (const std::string &name, bool primary, const tl::Variant &default_value)
|
||||
{
|
||||
const std::vector<db::DeviceParameterDefinition> &pd = parameter_definitions ();
|
||||
for (std::vector<db::DeviceParameterDefinition>::const_iterator i = pd.begin (); i != pd.end (); ++i) {
|
||||
if (i->name () == name) {
|
||||
return i->id ();
|
||||
}
|
||||
}
|
||||
|
||||
m_parameter_definitions.push_back (db::DeviceParameterDefinition ());
|
||||
|
||||
db::DeviceParameterDefinition &pdef = m_parameter_definitions.back ();
|
||||
pdef.set_id (m_parameter_definitions.size () - 1);
|
||||
|
||||
pdef.set_name (name);
|
||||
pdef.set_default_value (default_value);
|
||||
pdef.set_is_primary (primary);
|
||||
|
||||
return pdef.id ();
|
||||
}
|
||||
|
||||
bool DeviceClass::has_terminal_with_name (const std::string &name) const
|
||||
{
|
||||
const std::vector<db::DeviceTerminalDefinition> &td = terminal_definitions ();
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ public:
|
|||
*
|
||||
* The default value also declares the type.
|
||||
*/
|
||||
size_t parameter_id_for_name_create (const std::string &name, bool primary, const tl::Variant &default_value) const;
|
||||
size_t parameter_id_for_name_create (const std::string &name, bool primary, const tl::Variant &default_value);
|
||||
|
||||
/**
|
||||
* @brief Returns true, if the device has a terminal with the given name
|
||||
|
|
|
|||
|
|
@ -998,12 +998,13 @@ LayoutToNetlistStandardReader::terminal_id (const db::DeviceClass *device_class,
|
|||
throw tl::Exception (tl::to_string (tr ("Not a valid terminal name: ")) + tname + tl::to_string (tr (" for device class: ")) + device_class->name ());
|
||||
}
|
||||
|
||||
std::pair<db::DeviceAbstract *, const db::DeviceClass *>
|
||||
std::pair<db::DeviceAbstract *, db::DeviceClass *>
|
||||
LayoutToNetlistStandardReader::device_model_by_name (db::Netlist *netlist, const std::string &dmname)
|
||||
{
|
||||
for (db::Netlist::device_abstract_iterator i = netlist->begin_device_abstracts (); i != netlist->end_device_abstracts (); ++i) {
|
||||
if (i->name () == dmname) {
|
||||
return std::make_pair (i.operator-> (), i->device_class ());
|
||||
// TODO: get rid of the const cast
|
||||
return std::make_pair (i.operator-> (), const_cast<db::DeviceClass *> (i->device_class ()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1027,7 +1028,7 @@ LayoutToNetlistStandardReader::read_device (db::Netlist *netlist, db::LayoutToNe
|
|||
std::string dmname;
|
||||
read_word_or_quoted (dmname);
|
||||
|
||||
std::pair<db::DeviceAbstract *, const db::DeviceClass *> dm = device_model_by_name (netlist, dmname);
|
||||
std::pair<db::DeviceAbstract *, db::DeviceClass *> dm = device_model_by_name (netlist, dmname);
|
||||
|
||||
std::unique_ptr<db::Device> device (new db::Device ());
|
||||
device->set_device_class (const_cast<db::DeviceClass *> (dm.second));
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ protected:
|
|||
|
||||
void read_netlist (Netlist *netlist, db::LayoutToNetlist *l2n, Brace *nested = 0, std::map<const db::Circuit *, ObjectMap> *map_per_circuit = 0);
|
||||
static size_t terminal_id (const db::DeviceClass *device_class, const std::string &tname);
|
||||
static std::pair<db::DeviceAbstract *, const db::DeviceClass *> device_model_by_name (db::Netlist *netlist, const std::string &dmname);
|
||||
static std::pair<db::DeviceAbstract *, db::DeviceClass *> device_model_by_name (db::Netlist *netlist, const std::string &dmname);
|
||||
bool read_message (std::string &msg);
|
||||
bool read_severity (Severity &severity);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue