mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-03 16:30:20 +02:00
WIP: massive refactoring of properties repo and OASIS reader
Target is to reduce the properties repository to a singleton. Hence, there is no need to translate property IDs and it is possible to retrieve properties everywhere. The OASIS reader is refactored to avoid property renaming and change of property definitions per ID.
This commit is contained in:
@@ -95,12 +95,12 @@ GDS2ReaderBase::finish_element ()
|
||||
|
||||
|
||||
std::pair <bool, db::properties_id_type>
|
||||
GDS2ReaderBase::finish_element (db::PropertiesRepository &rep)
|
||||
GDS2ReaderBase::finish_element_with_props ()
|
||||
{
|
||||
bool any = false;
|
||||
long attr = 0;
|
||||
|
||||
db::PropertiesRepository::properties_set properties;
|
||||
db::PropertiesSet properties;
|
||||
|
||||
while (true) {
|
||||
|
||||
@@ -114,9 +114,7 @@ GDS2ReaderBase::finish_element (db::PropertiesRepository &rep)
|
||||
|
||||
const char *value = get_string ();
|
||||
if (m_read_properties) {
|
||||
properties.insert (std::make_pair (rep.prop_name_id (tl::Variant (attr)),
|
||||
tl::Variant (value)));
|
||||
|
||||
properties.insert (tl::Variant (attr), tl::Variant (value));
|
||||
any = true;
|
||||
}
|
||||
|
||||
@@ -132,7 +130,7 @@ GDS2ReaderBase::finish_element (db::PropertiesRepository &rep)
|
||||
}
|
||||
|
||||
if (any) {
|
||||
return std::make_pair (true, rep.properties_id (properties));
|
||||
return std::make_pair (true, db::properties_id (properties));
|
||||
} else {
|
||||
return std::make_pair (false, 0);
|
||||
}
|
||||
@@ -189,7 +187,7 @@ GDS2ReaderBase::do_read (db::Layout &layout)
|
||||
layout.add_meta_info ("access_time", MetaInfo (tl::to_string (tr ("Access Time")), tl::sprintf ("%d/%d/%d %d:%02d:%02d", access_time[1], access_time[2], access_time[0], access_time[3], access_time[4], access_time[5])));
|
||||
|
||||
long attr = 0;
|
||||
db::PropertiesRepository::properties_set layout_properties;
|
||||
db::PropertiesSet layout_properties;
|
||||
|
||||
// read until
|
||||
short rec_id = 0;
|
||||
@@ -225,7 +223,7 @@ GDS2ReaderBase::do_read (db::Layout &layout)
|
||||
|
||||
const char *value = get_string ();
|
||||
if (m_read_properties) {
|
||||
layout_properties.insert (std::make_pair (layout.properties_repository ().prop_name_id (tl::Variant (attr)), tl::Variant (value)));
|
||||
layout_properties.insert (tl::Variant (attr), tl::Variant (value));
|
||||
}
|
||||
|
||||
} else if (rec_id == sUNITS) {
|
||||
@@ -250,7 +248,7 @@ GDS2ReaderBase::do_read (db::Layout &layout)
|
||||
|
||||
// set the layout properties
|
||||
if (! layout_properties.empty ()) {
|
||||
layout.prop_id (layout.properties_repository ().properties_id (layout_properties));
|
||||
layout.prop_id (db::properties_id (layout_properties));
|
||||
}
|
||||
|
||||
// this container has been found to grow quite a lot.
|
||||
@@ -314,7 +312,7 @@ GDS2ReaderBase::do_read (db::Layout &layout)
|
||||
}
|
||||
|
||||
long attr = 0;
|
||||
db::PropertiesRepository::properties_set cell_properties;
|
||||
db::PropertiesSet cell_properties;
|
||||
|
||||
// read cell content
|
||||
while ((rec_id = get_record ()) != sENDSTR) {
|
||||
@@ -333,7 +331,7 @@ GDS2ReaderBase::do_read (db::Layout &layout)
|
||||
|
||||
const char *value = get_string ();
|
||||
if (m_read_properties) {
|
||||
cell_properties.insert (std::make_pair (layout.properties_repository ().prop_name_id (tl::Variant (attr)), tl::Variant (value)));
|
||||
cell_properties.insert (tl::Variant (attr), tl::Variant (value));
|
||||
}
|
||||
|
||||
} else if (rec_id == sBOUNDARY) {
|
||||
@@ -386,7 +384,7 @@ GDS2ReaderBase::do_read (db::Layout &layout)
|
||||
|
||||
// set the cell properties
|
||||
if (! cell_properties.empty ()) {
|
||||
cell->prop_id (layout.properties_repository ().properties_id (cell_properties));
|
||||
cell->prop_id (db::properties_id (cell_properties));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -603,7 +601,7 @@ GDS2ReaderBase::read_boundary (db::Layout &layout, db::Cell &cell, bool from_box
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<bool, db::properties_id_type> pp = finish_element (layout.properties_repository ());
|
||||
std::pair<bool, db::properties_id_type> pp = finish_element_with_props ();
|
||||
if (pp.first) {
|
||||
cell.shapes (ll.second).insert (db::BoxWithProperties (db::Box (p1, p2), pp.second));
|
||||
} else {
|
||||
@@ -662,7 +660,7 @@ GDS2ReaderBase::read_boundary (db::Layout &layout, db::Cell &cell, bool from_box
|
||||
finish_element ();
|
||||
} else {
|
||||
// this will copy the polyon:
|
||||
std::pair<bool, db::properties_id_type> pp = finish_element (layout.properties_repository ());
|
||||
std::pair<bool, db::properties_id_type> pp = finish_element_with_props ();
|
||||
if (pp.first) {
|
||||
cell.shapes (ll.second).insert (db::SimplePolygonRefWithProperties (db::SimplePolygonRef (poly, layout.shape_repository ()), pp.second));
|
||||
} else {
|
||||
@@ -799,7 +797,7 @@ GDS2ReaderBase::read_path (db::Layout &layout, db::Cell &cell)
|
||||
if (path.points () < 2 && type != 1) {
|
||||
warn (tl::to_string (tr ("PATH with less than two points encountered - interpretation may be different in other tools")));
|
||||
}
|
||||
std::pair<bool, db::properties_id_type> pp = finish_element (layout.properties_repository ());
|
||||
std::pair<bool, db::properties_id_type> pp = finish_element_with_props ();
|
||||
if (pp.first) {
|
||||
cell.shapes (ll.second).insert (db::PathRefWithProperties (db::PathRef (path, layout.shape_repository ()), pp.second));
|
||||
} else {
|
||||
@@ -935,7 +933,7 @@ GDS2ReaderBase::read_text (db::Layout &layout, db::Cell &cell)
|
||||
// Create the text
|
||||
db::Text text (get_string (), t, size, font, ha, va);
|
||||
|
||||
std::pair<bool, db::properties_id_type> pp = finish_element (layout.properties_repository ());
|
||||
std::pair<bool, db::properties_id_type> pp = finish_element_with_props ();
|
||||
if (pp.first) {
|
||||
cell.shapes (ll.second).insert (db::TextRefWithProperties (db::TextRef (text, layout.shape_repository ()), pp.second));
|
||||
} else {
|
||||
@@ -982,7 +980,7 @@ GDS2ReaderBase::read_box (db::Layout &layout, db::Cell &cell)
|
||||
box += pt_conv (*xy++);
|
||||
}
|
||||
|
||||
std::pair<bool, db::properties_id_type> pp = finish_element (layout.properties_repository ());
|
||||
std::pair<bool, db::properties_id_type> pp = finish_element_with_props ();
|
||||
if (! box.empty ()) {
|
||||
if (pp.first) {
|
||||
cell.shapes (ll.second).insert (db::BoxWithProperties (box, pp.second));
|
||||
@@ -1095,7 +1093,7 @@ GDS2ReaderBase::read_ref (db::Layout &layout, db::Cell & /*cell*/, bool array, t
|
||||
rows = 1;
|
||||
}
|
||||
|
||||
std::pair<bool, db::properties_id_type> pp = finish_element (layout.properties_repository ());
|
||||
std::pair<bool, db::properties_id_type> pp = finish_element_with_props ();
|
||||
|
||||
bool split_cols = false, split_rows = false;
|
||||
|
||||
@@ -1234,7 +1232,7 @@ GDS2ReaderBase::read_ref (db::Layout &layout, db::Cell & /*cell*/, bool array, t
|
||||
inst = db::CellInstArray (db::CellInst (ci), db::Trans (angle, mirror, xy));
|
||||
}
|
||||
|
||||
std::pair<bool, db::properties_id_type> pp = finish_element (layout.properties_repository ());
|
||||
std::pair<bool, db::properties_id_type> pp = finish_element_with_props ();
|
||||
if (pp.first) {
|
||||
instances_with_props.push_back (db::CellInstArrayWithProperties (inst, pp.second));
|
||||
} else {
|
||||
|
||||
@@ -97,7 +97,7 @@ private:
|
||||
void read_box (db::Layout &layout, db::Cell &cell);
|
||||
void read_ref (db::Layout &layout, db::Cell &cell, bool array, tl::vector<db::CellInstArray> &instances, tl::vector<db::CellInstArrayWithProperties> &insts_wp);
|
||||
|
||||
std::pair <bool, db::properties_id_type> finish_element (db::PropertiesRepository &rep);
|
||||
std::pair <bool, db::properties_id_type> finish_element_with_props ();
|
||||
void finish_element ();
|
||||
|
||||
virtual void common_reader_error (const std::string &msg) { error (msg); }
|
||||
|
||||
@@ -1090,10 +1090,10 @@ GDS2WriterBase::write_polygon (int layer, int datatype, double sf, const db::Sha
|
||||
void
|
||||
GDS2WriterBase::write_properties (const db::Layout &layout, db::properties_id_type prop_id)
|
||||
{
|
||||
const db::PropertiesRepository::properties_set &props = layout.properties_repository ().properties (prop_id);
|
||||
for (db::PropertiesRepository::properties_set::const_iterator p = props.begin (); p != props.end (); ++p) {
|
||||
auto props = db::properties (prop_id).to_map ();
|
||||
for (auto p = props.begin (); p != props.end (); ++p) {
|
||||
|
||||
const tl::Variant &name = layout.properties_repository ().prop_name (p->first);
|
||||
const tl::Variant &name = p->first;
|
||||
|
||||
long attr = -1;
|
||||
if (name.can_convert_to_long ()) {
|
||||
|
||||
@@ -827,9 +827,9 @@ DEFImporter::read_nets (db::Layout &layout, db::Cell &design, double scale, bool
|
||||
|
||||
db::properties_id_type prop_id = 0;
|
||||
if (produce_net_props ()) {
|
||||
db::PropertiesRepository::properties_set props;
|
||||
props.insert (std::make_pair (net_prop_name_id (), tl::Variant (net)));
|
||||
prop_id = layout.properties_repository ().properties_id (props);
|
||||
db::PropertiesSet props;
|
||||
props.insert (net_prop_name_id (), tl::Variant (net));
|
||||
prop_id = db::properties_id (props);
|
||||
}
|
||||
|
||||
while (test ("(")) {
|
||||
@@ -865,9 +865,9 @@ DEFImporter::read_nets (db::Layout &layout, db::Cell &design, double scale, bool
|
||||
net = stored_netname + "/" + subnetname;
|
||||
|
||||
if (produce_net_props ()) {
|
||||
db::PropertiesRepository::properties_set props;
|
||||
props.insert (std::make_pair (net_prop_name_id (), tl::Variant (net)));
|
||||
prop_id = layout.properties_repository ().properties_id (props);
|
||||
db::PropertiesSet props;
|
||||
props.insert (net_prop_name_id (), tl::Variant (net));
|
||||
prop_id = db::properties_id (props);
|
||||
}
|
||||
|
||||
} else if (! specialnets && test ("NONDEFAULTRULE")) {
|
||||
@@ -1371,14 +1371,14 @@ DEFImporter::read_pins (db::Layout &layout, db::Cell &design, double scale)
|
||||
|
||||
db::properties_id_type prop_id = 0;
|
||||
if (produce_pin_props () || produce_net_props ()) {
|
||||
db::PropertiesRepository::properties_set props;
|
||||
db::PropertiesSet props;
|
||||
if (produce_pin_props ()) {
|
||||
props.insert (std::make_pair (pin_prop_name_id (), tl::Variant (label)));
|
||||
props.insert (pin_prop_name_id (), tl::Variant (label));
|
||||
}
|
||||
if (produce_net_props ()) {
|
||||
props.insert (std::make_pair (net_prop_name_id (), tl::Variant (net)));
|
||||
props.insert (net_prop_name_id (), tl::Variant (net));
|
||||
}
|
||||
prop_id = layout.properties_repository ().properties_id (props);
|
||||
prop_id = db::properties_id (props);
|
||||
}
|
||||
|
||||
for (std::vector<db::Polygon>::const_iterator p = g->second.begin (); p != g->second.end (); ++p) {
|
||||
@@ -1944,9 +1944,9 @@ DEFImporter::do_read (db::Layout &layout)
|
||||
if (g->comp_matches (ii->first)) {
|
||||
|
||||
if (produce_inst_props ()) {
|
||||
db::PropertiesRepository::properties_set props;
|
||||
props.insert (std::make_pair (inst_prop_name_id (), tl::Variant (ii->first)));
|
||||
group_cell->insert (db::CellInstArrayWithProperties (ii->second, layout.properties_repository ().properties_id (props)));
|
||||
db::PropertiesSet props;
|
||||
props.insert (inst_prop_name_id (), tl::Variant (ii->first));
|
||||
group_cell->insert (db::CellInstArrayWithProperties (ii->second, db::properties_id (props)));
|
||||
} else {
|
||||
group_cell->insert (ii->second);
|
||||
}
|
||||
@@ -1993,9 +1993,9 @@ DEFImporter::do_read (db::Layout &layout)
|
||||
for (std::list<std::pair<std::string, db::CellInstArray> >::iterator ii = instances.begin (); ii != instances.end (); ++ii) {
|
||||
|
||||
if (produce_inst_props ()) {
|
||||
db::PropertiesRepository::properties_set props;
|
||||
props.insert (std::make_pair (inst_prop_name_id (), tl::Variant (ii->first)));
|
||||
others_cell->insert (db::CellInstArrayWithProperties (ii->second, layout.properties_repository ().properties_id (props)));
|
||||
db::PropertiesSet props;
|
||||
props.insert (inst_prop_name_id (), tl::Variant (ii->first));
|
||||
others_cell->insert (db::CellInstArrayWithProperties (ii->second, db::properties_id (props)));
|
||||
} else {
|
||||
others_cell->insert (ii->second);
|
||||
}
|
||||
|
||||
@@ -2032,7 +2032,7 @@ LEFDEFImporter::read (tl::InputStream &stream, db::Layout &layout, LEFDEFReaderS
|
||||
|
||||
if (m_options.produce_net_names ()) {
|
||||
m_produce_net_props = true;
|
||||
m_net_prop_name_id = layout.properties_repository ().prop_name_id (m_options.net_property_name ());
|
||||
m_net_prop_name_id = db::property_names_id (m_options.net_property_name ());
|
||||
}
|
||||
|
||||
m_produce_inst_props = false;
|
||||
@@ -2040,7 +2040,7 @@ LEFDEFImporter::read (tl::InputStream &stream, db::Layout &layout, LEFDEFReaderS
|
||||
|
||||
if (m_options.produce_inst_names ()) {
|
||||
m_produce_inst_props = true;
|
||||
m_inst_prop_name_id = layout.properties_repository ().prop_name_id (m_options.inst_property_name ());
|
||||
m_inst_prop_name_id = db::property_names_id (m_options.inst_property_name ());
|
||||
}
|
||||
|
||||
m_produce_pin_props = false;
|
||||
@@ -2048,7 +2048,7 @@ LEFDEFImporter::read (tl::InputStream &stream, db::Layout &layout, LEFDEFReaderS
|
||||
|
||||
if (m_options.produce_pin_names ()) {
|
||||
m_produce_pin_props = true;
|
||||
m_pin_prop_name_id = layout.properties_repository ().prop_name_id (m_options.pin_property_name ());
|
||||
m_pin_prop_name_id = db::property_names_id (m_options.pin_property_name ());
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -956,9 +956,9 @@ LEFImporter::read_macro (Layout &layout)
|
||||
|
||||
db::properties_id_type prop_id = 0;
|
||||
if (produce_pin_props ()) {
|
||||
db::PropertiesRepository::properties_set props;
|
||||
props.insert (std::make_pair (pin_prop_name_id (), tl::Variant (label)));
|
||||
prop_id = layout.properties_repository ().properties_id (props);
|
||||
db::PropertiesSet props;
|
||||
props.insert (pin_prop_name_id (), tl::Variant (label));
|
||||
prop_id = db::properties_id (props);
|
||||
}
|
||||
|
||||
std::map <std::string, db::Box> boxes_for_labels;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -180,7 +180,10 @@ private:
|
||||
|
||||
std::map <unsigned long, db::property_names_id_type> m_propname_forward_references;
|
||||
std::map <unsigned long, std::string> m_propvalue_forward_references;
|
||||
std::set <db::properties_id_type> m_prop_ids;
|
||||
std::map <db::properties_id_type, std::list<db::Shape> > m_forward_properties_for_shapes;
|
||||
std::map <db::properties_id_type, std::list<db::Instance> > m_forward_properties_for_instances;
|
||||
std::map <db::cell_index_type, db::PropertiesSet> m_future_cell_properties;
|
||||
std::list<db::PropertiesSet> m_fwd_properties;
|
||||
db::property_names_id_type m_s_gds_property_name_id;
|
||||
db::property_names_id_type m_klayout_context_property_name_id;
|
||||
|
||||
@@ -207,10 +210,18 @@ private:
|
||||
void read_offset_table ();
|
||||
bool read_repetition ();
|
||||
void read_pointlist (modal_variable <std::vector <db::Point> > &pointlist, bool for_polygon);
|
||||
void read_properties (db::PropertiesRepository &rep);
|
||||
void store_last_properties (db::PropertiesRepository &rep, db::PropertiesRepository::properties_set &properties, bool ignore_special);
|
||||
std::pair <bool, db::properties_id_type> read_element_properties (db::PropertiesRepository &rep, bool ignore_special);
|
||||
void read_properties ();
|
||||
void store_last_properties (db::PropertiesSet &properties, bool ignore_special, bool with_context_props = false);
|
||||
std::pair <bool, db::properties_id_type> read_element_properties (bool ignore_special);
|
||||
void replace_forward_references_in_variant (tl::Variant &v);
|
||||
void extract_context_strings (db::PropertiesSet &properties, std::vector<tl::Variant> &context_strings);
|
||||
bool has_forward_refs (const db::PropertiesSet &properties);
|
||||
db::properties_id_type make_forward_properties_id (const db::PropertiesSet &properties);
|
||||
const db::PropertiesSet &forward_properties (db::properties_id_type id) const;
|
||||
bool is_forward_properties_id (db::properties_id_type id) const;
|
||||
void register_forward_property_for_shape (const db::Shape &shape);
|
||||
void register_forward_property_for_instance (const db::Instance &instance);
|
||||
void resolve_forward_references (db::PropertiesSet &properties);
|
||||
|
||||
unsigned char get_byte ()
|
||||
{
|
||||
|
||||
@@ -997,10 +997,10 @@ OASISWriter::write_ucoord (db::Coord c)
|
||||
void
|
||||
OASISWriter::emit_propname_def (db::properties_id_type prop_id)
|
||||
{
|
||||
const db::PropertiesRepository::properties_set &props = mp_layout->properties_repository ().properties (prop_id);
|
||||
for (db::PropertiesRepository::properties_set::const_iterator p = props.begin (); p != props.end (); ++p) {
|
||||
auto props = db::properties (prop_id).to_map ();
|
||||
for (auto p = props.begin (); p != props.end (); ++p) {
|
||||
|
||||
const tl::Variant &name = mp_layout->properties_repository ().prop_name (p->first);
|
||||
const tl::Variant &name = p->first;
|
||||
const char *name_str = s_gds_property_name;
|
||||
if (! make_gds_property (name)) {
|
||||
name_str = name.to_string ();
|
||||
@@ -1019,13 +1019,13 @@ OASISWriter::emit_propstring_def (db::properties_id_type prop_id)
|
||||
{
|
||||
std::vector<tl::Variant> pv_list;
|
||||
|
||||
const db::PropertiesRepository::properties_set &props = mp_layout->properties_repository ().properties (prop_id);
|
||||
for (db::PropertiesRepository::properties_set::const_iterator p = props.begin (); p != props.end (); ++p) {
|
||||
auto props = db::properties (prop_id).to_map ();
|
||||
for (auto p = props.begin (); p != props.end (); ++p) {
|
||||
|
||||
pv_list.clear ();
|
||||
const std::vector<tl::Variant> *pvl = &pv_list;
|
||||
|
||||
const tl::Variant &name = mp_layout->properties_repository ().prop_name (p->first);
|
||||
const tl::Variant &name = p->first;
|
||||
if (! make_gds_property (name)) {
|
||||
|
||||
if (p->second.is_list ()) {
|
||||
@@ -2117,13 +2117,13 @@ OASISWriter::write_props (db::properties_id_type prop_id)
|
||||
{
|
||||
std::vector<tl::Variant> pv_list;
|
||||
|
||||
const db::PropertiesRepository::properties_set &props = mp_layout->properties_repository ().properties (prop_id);
|
||||
auto props = db::properties (prop_id).to_map ();
|
||||
|
||||
for (db::PropertiesRepository::properties_set::const_iterator p = props.begin (); p != props.end (); ++p) {
|
||||
for (auto p = props.begin (); p != props.end (); ++p) {
|
||||
|
||||
m_progress.set (mp_stream->pos ());
|
||||
|
||||
const tl::Variant &name = mp_layout->properties_repository ().prop_name (p->first);
|
||||
const tl::Variant &name = p->first;
|
||||
|
||||
const char *name_str = s_gds_property_name;
|
||||
bool sflag = true;
|
||||
|
||||
@@ -650,18 +650,16 @@ TEST(Bug_1799)
|
||||
reader.read (layout);
|
||||
}
|
||||
|
||||
db::properties_id_type pn = layout.properties_repository ().prop_name_id (tl::Variant (1));
|
||||
db::PropertiesRepository::properties_set ps;
|
||||
ps.insert (std::make_pair (pn, tl::Variant ("hello, world!")));
|
||||
db::properties_id_type pn = db::property_names_id (tl::Variant (1));
|
||||
db::PropertiesSet ps;
|
||||
ps.insert (pn, tl::Variant ("hello, world!"));
|
||||
|
||||
auto pid = layout.properties_repository ().properties_id (ps);
|
||||
auto pid = db::properties_id (ps);
|
||||
|
||||
auto ps2 = layout.properties_repository ().properties (pid);
|
||||
auto ps2 = db::properties (pid);
|
||||
EXPECT_EQ (ps2.size (), size_t (1));
|
||||
EXPECT_EQ (ps2.find (pn) != ps2.end (), true);
|
||||
if (ps2.find (pn) != ps2.end ()) {
|
||||
EXPECT_EQ (ps2.find (pn)->second.to_string (), "hello, world!");
|
||||
}
|
||||
EXPECT_EQ (ps2.has_value (pn), true);
|
||||
EXPECT_EQ (ps2.value (pn).to_string (), "hello, world!");
|
||||
}
|
||||
|
||||
TEST(DuplicateCellname)
|
||||
|
||||
@@ -1207,19 +1207,19 @@ TEST(115)
|
||||
db::Layout g (&m);
|
||||
|
||||
db::property_names_id_type n1, n2, n3;
|
||||
n1 = g.properties_repository ().prop_name_id (tl::Variant (17));
|
||||
n2 = g.properties_repository ().prop_name_id (tl::Variant ("name"));
|
||||
n3 = g.properties_repository ().prop_name_id (tl::Variant ((unsigned int) 42));
|
||||
n1 = db::property_names_id (tl::Variant (17));
|
||||
n2 = db::property_names_id (tl::Variant ("name"));
|
||||
n3 = db::property_names_id (tl::Variant ((unsigned int) 42));
|
||||
|
||||
db::PropertiesRepository::properties_set s1;
|
||||
s1.insert (std::make_pair (n1, tl::Variant ("17value")));
|
||||
s1.insert (std::make_pair (n2, tl::Variant (117)));
|
||||
db::PropertiesSet s1;
|
||||
s1.insert (n1, tl::Variant ("17value"));
|
||||
s1.insert (n2, tl::Variant (117));
|
||||
|
||||
db::PropertiesRepository::properties_set s2;
|
||||
s2.insert (std::make_pair (n3, tl::Variant (42)));
|
||||
db::PropertiesSet s2;
|
||||
s2.insert (n3, tl::Variant (42));
|
||||
|
||||
db::properties_id_type p1 = g.properties_repository ().properties_id (s1);
|
||||
db::properties_id_type p2 = g.properties_repository ().properties_id (s2);
|
||||
db::properties_id_type p1 = db::properties_id (s1);
|
||||
db::properties_id_type p2 = db::properties_id (s2);
|
||||
|
||||
g.prop_id (p1);
|
||||
|
||||
@@ -1288,19 +1288,19 @@ TEST(116)
|
||||
db::Layout g (&m);
|
||||
|
||||
db::property_names_id_type n1, n2, n3;
|
||||
n1 = g.properties_repository ().prop_name_id (tl::Variant (17));
|
||||
n2 = g.properties_repository ().prop_name_id (tl::Variant ("name"));
|
||||
n3 = g.properties_repository ().prop_name_id (tl::Variant ((unsigned int) 42));
|
||||
n1 = db::property_names_id (tl::Variant (17));
|
||||
n2 = db::property_names_id (tl::Variant ("name"));
|
||||
n3 = db::property_names_id (tl::Variant ((unsigned int) 42));
|
||||
|
||||
db::PropertiesRepository::properties_set s1;
|
||||
s1.insert (std::make_pair (n1, tl::Variant ("17value")));
|
||||
s1.insert (std::make_pair (n2, tl::Variant (117)));
|
||||
db::PropertiesSet s1;
|
||||
s1.insert (n1, tl::Variant ("17value"));
|
||||
s1.insert (n2, tl::Variant (117));
|
||||
|
||||
db::PropertiesRepository::properties_set s2;
|
||||
s2.insert (std::make_pair (n3, tl::Variant (42)));
|
||||
db::PropertiesSet s2;
|
||||
s2.insert (n3, tl::Variant (42));
|
||||
|
||||
db::properties_id_type p1 = g.properties_repository ().properties_id (s1);
|
||||
db::properties_id_type p2 = g.properties_repository ().properties_id (s2);
|
||||
db::properties_id_type p1 = db::properties_id (s1);
|
||||
db::properties_id_type p2 = db::properties_id (s2);
|
||||
|
||||
g.prop_id (p1);
|
||||
|
||||
|
||||
@@ -111,9 +111,9 @@ private:
|
||||
size_t m_obj_index;
|
||||
|
||||
void produce_cell_inst (const db::CellInstArrayWithProperties &ci, const db::Layout *layout, const rdb::Category *cat);
|
||||
template <class SH> void produce_diffs_for_xor (const db::PropertiesRepository &pr, const std::vector <std::pair <SH, db::properties_id_type> > &a, const std::vector <std::pair <SH, db::properties_id_type> > &b, double dbu_a, db::Shapes &shapes);
|
||||
template <class SH> void produce_diffs (const db::PropertiesRepository &pr, const std::vector <std::pair <SH, db::properties_id_type> > &a, const std::vector <std::pair <SH, db::properties_id_type> > &b, double dbu_a, const rdb::Category *cat);
|
||||
template <class SH> void shape_diffs (const db::PropertiesRepository &pr, const std::vector <std::pair <SH, db::properties_id_type> > &a, const std::vector <std::pair <SH, db::properties_id_type> > &b);
|
||||
template <class SH> void produce_diffs_for_xor (const std::vector <std::pair <SH, db::properties_id_type> > &a, const std::vector <std::pair <SH, db::properties_id_type> > &b, double dbu_a, db::Shapes &shapes);
|
||||
template <class SH> void produce_diffs (const std::vector <std::pair <SH, db::properties_id_type> > &a, const std::vector <std::pair <SH, db::properties_id_type> > &b, double dbu_a, const rdb::Category *cat);
|
||||
template <class SH> void shape_diffs (const std::vector <std::pair <SH, db::properties_id_type> > &a, const std::vector <std::pair <SH, db::properties_id_type> > &b);
|
||||
void shape_diffs_found ();
|
||||
};
|
||||
|
||||
@@ -200,12 +200,12 @@ RdbDifferenceReceiver::RdbDifferenceReceiver (const db::Layout &layout_a, const
|
||||
}
|
||||
|
||||
static void
|
||||
add_property_text (rdb::Item *item, const db::PropertiesRepository &pr, db::properties_id_type prop_id)
|
||||
add_property_text (rdb::Item *item, db::properties_id_type prop_id)
|
||||
{
|
||||
if (prop_id != 0) {
|
||||
const db::PropertiesRepository::properties_set &p = pr.properties (prop_id);
|
||||
for (db::PropertiesRepository::properties_set::const_iterator pp = p.begin (); pp != p.end (); ++pp) {
|
||||
const tl::Variant &name = pr.prop_name (pp->first);
|
||||
auto p = db::properties (prop_id).to_map ();
|
||||
for (auto pp = p.begin (); pp != p.end (); ++pp) {
|
||||
const tl::Variant &name = pp->first;
|
||||
std::string r = std::string ("property: ") + name.to_string () + " = " + pp->second.to_string ();
|
||||
item->add_value (r);
|
||||
}
|
||||
@@ -237,7 +237,7 @@ RdbDifferenceReceiver::produce_cell_inst (const db::CellInstArrayWithProperties
|
||||
item->add_value (box * layout->dbu ());
|
||||
|
||||
if (m_with_properties) {
|
||||
add_property_text (item, layout->properties_repository (), ci.properties_id ());
|
||||
add_property_text (item, ci.properties_id ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,13 +315,13 @@ RdbDifferenceReceiver::begin_inst_differences ()
|
||||
}
|
||||
|
||||
void
|
||||
RdbDifferenceReceiver::instances_in_a (const std::vector <db::CellInstArrayWithProperties> & /*insts_a*/, const std::vector <std::string> & /*cell_names*/, const db::PropertiesRepository & /*props*/)
|
||||
RdbDifferenceReceiver::instances_in_a (const std::vector <db::CellInstArrayWithProperties> & /*insts_a*/, const std::vector <std::string> & /*cell_names*/)
|
||||
{
|
||||
// .. nothing ..
|
||||
}
|
||||
|
||||
void
|
||||
RdbDifferenceReceiver::instances_in_b (const std::vector <db::CellInstArrayWithProperties> & /*insts_b*/, const std::vector <std::string> & /*cell_names*/, const db::PropertiesRepository & /*props*/)
|
||||
RdbDifferenceReceiver::instances_in_b (const std::vector <db::CellInstArrayWithProperties> & /*insts_b*/, const std::vector <std::string> & /*cell_names*/)
|
||||
{
|
||||
// .. nothing ..
|
||||
}
|
||||
@@ -469,7 +469,7 @@ inline std::string shape_type (const db::Box &)
|
||||
|
||||
template <class SH>
|
||||
void
|
||||
RdbDifferenceReceiver::produce_diffs_for_xor (const db::PropertiesRepository & /*pr*/, const std::vector <std::pair <SH, db::properties_id_type> > &a, const std::vector <std::pair <SH, db::properties_id_type> > &b, double dbu_a, db::Shapes &shapes)
|
||||
RdbDifferenceReceiver::produce_diffs_for_xor (const std::vector <std::pair <SH, db::properties_id_type> > &a, const std::vector <std::pair <SH, db::properties_id_type> > &b, double dbu_a, db::Shapes &shapes)
|
||||
{
|
||||
db::CplxTrans t (dbu_a);
|
||||
std::vector <std::pair <SH, db::properties_id_type> > anotb;
|
||||
@@ -481,7 +481,7 @@ RdbDifferenceReceiver::produce_diffs_for_xor (const db::PropertiesRepository & /
|
||||
|
||||
template <class SH>
|
||||
void
|
||||
RdbDifferenceReceiver::produce_diffs (const db::PropertiesRepository &pr, const std::vector <std::pair <SH, db::properties_id_type> > &a, const std::vector <std::pair <SH, db::properties_id_type> > &b, double dbu_a, const rdb::Category *cat)
|
||||
RdbDifferenceReceiver::produce_diffs (const std::vector <std::pair <SH, db::properties_id_type> > &a, const std::vector <std::pair <SH, db::properties_id_type> > &b, double dbu_a, const rdb::Category *cat)
|
||||
{
|
||||
db::CplxTrans t (dbu_a);
|
||||
std::vector <std::pair <SH, db::properties_id_type> > anotb;
|
||||
@@ -499,7 +499,7 @@ RdbDifferenceReceiver::produce_diffs (const db::PropertiesRepository &pr, const
|
||||
item->add_value (t * s->first);
|
||||
|
||||
if (s->second && m_with_properties) {
|
||||
add_property_text (item, pr, s->second);
|
||||
add_property_text (item, s->second);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -507,15 +507,15 @@ RdbDifferenceReceiver::produce_diffs (const db::PropertiesRepository &pr, const
|
||||
|
||||
template <class SH>
|
||||
void
|
||||
RdbDifferenceReceiver::shape_diffs (const db::PropertiesRepository &pr, const std::vector <std::pair <SH, db::properties_id_type> > &a, const std::vector <std::pair <SH, db::properties_id_type> > &b)
|
||||
RdbDifferenceReceiver::shape_diffs (const std::vector <std::pair <SH, db::properties_id_type> > &a, const std::vector <std::pair <SH, db::properties_id_type> > &b)
|
||||
{
|
||||
if (m_detailed && m_is_valid_layer_index_a && mp_a_only_per_layer_cat [m_layer_index_a] != 0) {
|
||||
produce_diffs (pr, a, b, mp_layout_a->dbu (), mp_a_only_per_layer_cat [m_layer_index_a]);
|
||||
produce_diffs (a, b, mp_layout_a->dbu (), mp_a_only_per_layer_cat [m_layer_index_a]);
|
||||
}
|
||||
|
||||
if (m_run_xor && m_is_valid_layer_index_a) {
|
||||
db::Shapes shapes;
|
||||
produce_diffs_for_xor (pr, a, b, mp_layout_a->dbu (), shapes);
|
||||
produce_diffs_for_xor (a, b, mp_layout_a->dbu (), shapes);
|
||||
for (db::Shapes::shape_iterator s = shapes.begin (db::Shapes::shape_iterator::All); ! s.at_end (); ++s) {
|
||||
m_ep.insert (*s, m_obj_index * 2);
|
||||
++m_obj_index;
|
||||
@@ -523,12 +523,12 @@ RdbDifferenceReceiver::shape_diffs (const db::PropertiesRepository &pr, const st
|
||||
}
|
||||
|
||||
if (m_detailed && m_is_valid_layer_index_b && mp_b_only_per_layer_cat [m_layer_index_b] != 0) {
|
||||
produce_diffs (pr, b, a, mp_layout_b->dbu (), mp_b_only_per_layer_cat [m_layer_index_b]);
|
||||
produce_diffs (b, a, mp_layout_b->dbu (), mp_b_only_per_layer_cat [m_layer_index_b]);
|
||||
}
|
||||
|
||||
if (m_run_xor && m_is_valid_layer_index_b) {
|
||||
db::Shapes shapes;
|
||||
produce_diffs_for_xor (pr, b, a, mp_layout_b->dbu (), shapes);
|
||||
produce_diffs_for_xor (b, a, mp_layout_b->dbu (), shapes);
|
||||
for (db::Shapes::shape_iterator s = shapes.begin (db::Shapes::shape_iterator::All); ! s.at_end (); ++s) {
|
||||
m_ep.insert (*s, m_obj_index * 2 + 1);
|
||||
++m_obj_index;
|
||||
|
||||
Reference in New Issue
Block a user