Skip to content

Commit

Permalink
First proposal for feature (#1626)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthias Koefferlein <matthias@klayout.de>
  • Loading branch information
klayoutmatthias and Matthias Koefferlein committed Feb 15, 2024
1 parent 8c164dc commit 859a09b
Show file tree
Hide file tree
Showing 7 changed files with 340 additions and 181 deletions.
23 changes: 23 additions & 0 deletions src/db/db/dbTechnology.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ Technology::~Technology ()
Technology::Technology (const Technology &d)
: tl::Object (),
m_name (d.m_name), m_description (d.m_description), m_group (d.m_group), m_grain_name (d.m_grain_name), m_dbu (d.m_dbu),
m_default_grids (d.m_default_grids),
m_explicit_base_path (d.m_explicit_base_path), m_default_base_path (d.m_default_base_path),
m_load_layout_options (d.m_load_layout_options),
m_save_layout_options (d.m_save_layout_options),
Expand All @@ -303,6 +304,7 @@ Technology &Technology::operator= (const Technology &d)
m_group = d.m_group;
m_grain_name = d.m_grain_name;
m_dbu = d.m_dbu;
m_default_grids = d.m_default_grids;
m_default_base_path = d.m_default_base_path;
m_explicit_base_path = d.m_explicit_base_path;
m_load_layout_options = d.m_load_layout_options;
Expand Down Expand Up @@ -345,6 +347,26 @@ Technology::get_display_string () const
return d;
}

std::vector<double>
Technology::default_grid_list () const
{
tl::Extractor ex (m_default_grids.c_str ());

std::vector<double> grids;

// convert the list of grids to a list of doubles
while (! ex.at_end ()) {
double g = 0.0;
if (! ex.try_read (g)) {
break;
}
grids.push_back (g);
ex.test (",");
}

return grids;
}

tl::XMLElementList
Technology::xml_elements ()
{
Expand All @@ -353,6 +375,7 @@ Technology::xml_elements ()
tl::make_member (&Technology::description, &Technology::set_description, "description") +
tl::make_member (&Technology::group, &Technology::set_group, "group") +
tl::make_member (&Technology::dbu, &Technology::set_dbu, "dbu") +
tl::make_member (&Technology::default_grids, &Technology::set_default_grids, "default-grids") +
tl::make_member (&Technology::explicit_base_path, &Technology::set_explicit_base_path, "base-path") +
tl::make_member (&Technology::default_base_path, &Technology::set_default_base_path, "original-base-path") +
tl::make_member (&Technology::layer_properties_file, &Technology::set_layer_properties_file, "layer-properties_file") +
Expand Down
25 changes: 25 additions & 0 deletions src/db/db/dbTechnology.h
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,30 @@ class DB_PUBLIC Technology
}
}

/**
* @brief Gets the default grids
*/
const std::string &default_grids () const
{
return m_default_grids;
}

/**
* @brief Gets the default grids, parsed as a list of double values
*/
std::vector<double> default_grid_list () const;

/**
* @brief Sets the default default grids
*/
void set_default_grids (const std::string &default_grids)
{
if (default_grids != m_default_grids) {
m_default_grids = default_grids;
technology_changed ();
}
}

/**
* @brief Gets the layer properties file path (empty if none is specified)
*/
Expand Down Expand Up @@ -650,6 +674,7 @@ class DB_PUBLIC Technology
std::string m_name, m_description, m_group;
std::string m_grain_name;
double m_dbu;
std::string m_default_grids;
std::string m_explicit_base_path, m_default_base_path;
db::LoadLayoutOptions m_load_layout_options;
db::SaveLayoutOptions m_save_layout_options;
Expand Down
Loading

0 comments on commit 859a09b

Please sign in to comment.