mirror of https://github.com/KLayout/klayout.git
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:
parent
9ea7e68576
commit
dd7aa9b84f
|
|
@ -82,7 +82,6 @@ void clip (ClipData &data)
|
|||
}
|
||||
|
||||
// copy the properties repository in order to have the same ID mapping
|
||||
target_layout.properties_repository () = layout.properties_repository ();
|
||||
target_layout.dbu (layout.dbu ());
|
||||
|
||||
// look for the clip layer
|
||||
|
|
|
|||
|
|
@ -117,6 +117,12 @@ PropertiesSet::has_value (const tl::Variant &name) const
|
|||
return m_map.find (nid) != m_map.end ();
|
||||
}
|
||||
|
||||
bool
|
||||
PropertiesSet::has_value (db::property_names_id_type nid) const
|
||||
{
|
||||
return m_map.find (nid) != m_map.end ();
|
||||
}
|
||||
|
||||
const tl::Variant &
|
||||
PropertiesSet::value (const tl::Variant &name) const
|
||||
{
|
||||
|
|
@ -130,6 +136,18 @@ PropertiesSet::value (const tl::Variant &name) const
|
|||
}
|
||||
}
|
||||
|
||||
const tl::Variant &
|
||||
PropertiesSet::value (db::property_names_id_type nid) const
|
||||
{
|
||||
auto i = m_map.find (nid);
|
||||
if (i == m_map.end () || i->second != nid) {
|
||||
static tl::Variant nil;
|
||||
return nil;
|
||||
} else {
|
||||
return property_value (i->second);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PropertiesSet::clear ()
|
||||
{
|
||||
|
|
@ -169,6 +187,12 @@ PropertiesSet::insert (db::property_names_id_type nid, const tl::Variant &value)
|
|||
m_map.insert (std::make_pair (nid, db::property_values_id (value)));
|
||||
}
|
||||
|
||||
void
|
||||
PropertiesSet::merge (const db::PropertiesSet &other)
|
||||
{
|
||||
m_map.insert (other.m_map.begin (), other.m_map.end ());
|
||||
}
|
||||
|
||||
std::multimap<tl::Variant, tl::Variant>
|
||||
PropertiesSet::to_map () const
|
||||
{
|
||||
|
|
@ -203,39 +227,15 @@ PropertiesSet::to_list_var () const
|
|||
return var;
|
||||
}
|
||||
|
||||
void
|
||||
PropertiesSet::change_name (property_names_id_type from, property_names_id_type to)
|
||||
{
|
||||
map_type org_map;
|
||||
org_map.swap (m_map);
|
||||
|
||||
for (auto i = org_map.begin (); i != org_map.end (); ++i) {
|
||||
if (i->first == from) {
|
||||
m_map.insert (std::make_pair (to, i->second));
|
||||
} else {
|
||||
m_map.insert (*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PropertiesSet::change_value (property_values_id_type from, property_values_id_type to)
|
||||
{
|
||||
map_type org_map;
|
||||
org_map.swap (m_map);
|
||||
|
||||
for (auto i = org_map.begin (); i != org_map.end (); ++i) {
|
||||
if (i->second == from) {
|
||||
m_map.insert (std::make_pair (i->first, to));
|
||||
} else {
|
||||
m_map.insert (*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// PropertiesRepository implementation
|
||||
|
||||
PropertiesRepository &PropertiesRepository::instance ()
|
||||
{
|
||||
static PropertiesRepository s_instance;
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
PropertiesRepository::PropertiesRepository ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
|
|
@ -300,55 +300,7 @@ PropertiesRepository::prop_value_id (const tl::Variant &value)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
PropertiesRepository::change_name (property_names_id_type id, const tl::Variant &new_name)
|
||||
{
|
||||
db::property_names_id_type new_id = property_names_id (new_name);
|
||||
if (new_id == id) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto &new_pids = m_properties_by_name_table [new_id];
|
||||
|
||||
auto pids = m_properties_by_name_table.find (id);
|
||||
if (pids != m_properties_by_name_table.end ()) {
|
||||
for (auto pid = pids->second.begin (); pid != pids->second.end (); ++pid) {
|
||||
PropertiesSet *ps = reinterpret_cast<PropertiesSet *> (*pid);
|
||||
m_properties.erase (ps);
|
||||
ps->change_name (id, new_id);
|
||||
m_properties.insert (ps);
|
||||
new_pids.insert (*pid);
|
||||
}
|
||||
}
|
||||
|
||||
m_properties_by_name_table.erase (id);
|
||||
}
|
||||
|
||||
void
|
||||
PropertiesRepository::change_value (property_values_id_type id, const tl::Variant &new_value)
|
||||
{
|
||||
db::property_values_id_type new_id = property_values_id (new_value);
|
||||
if (new_id == id) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto &new_pids = m_properties_by_value_table [new_id];
|
||||
|
||||
auto pids = m_properties_by_value_table.find (id);
|
||||
if (pids != m_properties_by_value_table.end ()) {
|
||||
for (auto pid = pids->second.begin (); pid != pids->second.end (); ++pid) {
|
||||
PropertiesSet *ps = reinterpret_cast<PropertiesSet *> (*pid);
|
||||
m_properties.erase (ps);
|
||||
ps->change_value (id, new_id);
|
||||
m_properties.insert (ps);
|
||||
new_pids.insert (*pid);
|
||||
}
|
||||
}
|
||||
|
||||
m_properties_by_value_table.erase (id);
|
||||
}
|
||||
|
||||
properties_id_type
|
||||
properties_id_type
|
||||
PropertiesRepository::properties_id (const PropertiesSet &props)
|
||||
{
|
||||
if (props.empty ()) {
|
||||
|
|
@ -452,33 +404,6 @@ PropertiesRepository::properties_ids_by_name_value (db::property_names_id_type n
|
|||
return result;
|
||||
}
|
||||
|
||||
properties_id_type
|
||||
PropertiesRepository::allocate_properties ()
|
||||
{
|
||||
tl::MutexLocker locker (&m_lock);
|
||||
|
||||
m_properties_heap.push_back (PropertiesSet ());
|
||||
return db::properties_id_type (& m_properties_heap.back ());
|
||||
}
|
||||
|
||||
property_names_id_type
|
||||
PropertiesRepository::allocate_property_names_id ()
|
||||
{
|
||||
tl::MutexLocker locker (&m_lock);
|
||||
|
||||
m_property_names_heap.push_back (tl::Variant ());
|
||||
return db::property_names_id_type (& m_property_names_heap.back ());
|
||||
}
|
||||
|
||||
property_names_id_type
|
||||
PropertiesRepository::allocate_property_values_id ()
|
||||
{
|
||||
tl::MutexLocker locker (&m_lock);
|
||||
|
||||
m_property_values_heap.push_back (tl::Variant ());
|
||||
return db::property_values_id_type (& m_property_values_heap.back ());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// PropertiesRepository implementation
|
||||
|
||||
|
|
|
|||
|
|
@ -42,22 +42,22 @@ namespace db
|
|||
/**
|
||||
* @brief Gets a name entry from the property name ID
|
||||
*/
|
||||
const tl::Variant &property_name (db::property_names_id_type id);
|
||||
DB_PUBLIC const tl::Variant &property_name (db::property_names_id_type id);
|
||||
|
||||
/**
|
||||
* @brief Gets the property name ID from a property name
|
||||
*/
|
||||
db::property_names_id_type property_names_id (const tl::Variant &pn);
|
||||
DB_PUBLIC db::property_names_id_type property_names_id (const tl::Variant &pn);
|
||||
|
||||
/**
|
||||
* @brief Gets a value entry from the property value ID
|
||||
*/
|
||||
const tl::Variant &property_value (db::property_values_id_type id);
|
||||
DB_PUBLIC const tl::Variant &property_value (db::property_values_id_type id);
|
||||
|
||||
/**
|
||||
* @brief Gets the property value ID from a property value
|
||||
*/
|
||||
db::property_values_id_type property_values_id (const tl::Variant &pv);
|
||||
DB_PUBLIC db::property_values_id_type property_values_id (const tl::Variant &pv);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -71,6 +71,7 @@ class DB_PUBLIC PropertiesSet
|
|||
public:
|
||||
typedef std::multimap<db::property_names_id_type, db::property_values_id_type> map_type;
|
||||
typedef map_type::const_iterator iterator;
|
||||
typedef map_type::iterator non_const_iterator;
|
||||
|
||||
/**
|
||||
* @brief The default constructor
|
||||
|
|
@ -117,6 +118,14 @@ public:
|
|||
*/
|
||||
bool operator< (const PropertiesSet &other) const;
|
||||
|
||||
/**
|
||||
* @brief Swaps with another properties set
|
||||
*/
|
||||
void swap (PropertiesSet &other)
|
||||
{
|
||||
m_map.swap (other.m_map);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets a value indicating whether the properties set is empty
|
||||
*/
|
||||
|
|
@ -125,16 +134,34 @@ public:
|
|||
return m_map.empty ();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the size of the properties set
|
||||
*/
|
||||
size_t size () const
|
||||
{
|
||||
return m_map.size ();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets a value indicating whether the given name is contained in the set
|
||||
*/
|
||||
bool has_value (const tl::Variant &name) const;
|
||||
|
||||
/**
|
||||
* @brief Gets a value indicating whether the given name is contained in the set
|
||||
*/
|
||||
bool has_value (db::property_names_id_type name_id) const;
|
||||
|
||||
/**
|
||||
* @brief Gets the value for the given name or a nil variant if there is no value for this name
|
||||
*/
|
||||
const tl::Variant &value (const tl::Variant &name) const;
|
||||
|
||||
/**
|
||||
* @brief Gets the value for the given name or a nil variant if there is no value for this name
|
||||
*/
|
||||
const tl::Variant &value (db::property_names_id_type name_id) const;
|
||||
|
||||
/**
|
||||
* @brief operator[] as alias for "value"
|
||||
*/
|
||||
|
|
@ -143,6 +170,14 @@ public:
|
|||
return value (name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief operator[] as alias for "value"
|
||||
*/
|
||||
const tl::Variant &operator[] (db::property_names_id_type name_id) const
|
||||
{
|
||||
return value (name_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clears the properties set
|
||||
*/
|
||||
|
|
@ -168,6 +203,11 @@ public:
|
|||
*/
|
||||
void insert (db::property_names_id_type name_id, const tl::Variant &value);
|
||||
|
||||
/**
|
||||
* @brief Merge another properties set into self
|
||||
*/
|
||||
void merge (const db::PropertiesSet &other);
|
||||
|
||||
/**
|
||||
* @brief Gets the properties as a map
|
||||
*/
|
||||
|
|
@ -205,24 +245,38 @@ public:
|
|||
return m_map.end ();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Non-const iterator (begin)
|
||||
*
|
||||
* This iterator delivers key/value pairs in the ID form.
|
||||
* The order is basically undefined.
|
||||
*/
|
||||
non_const_iterator begin_non_const ()
|
||||
{
|
||||
return m_map.begin ();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Non-const iterator (end)
|
||||
*/
|
||||
non_const_iterator end_non_const ()
|
||||
{
|
||||
return m_map.end ();
|
||||
}
|
||||
|
||||
private:
|
||||
map_type m_map;
|
||||
|
||||
friend class PropertiesRepository;
|
||||
|
||||
void change_name (property_names_id_type from, property_names_id_type to);
|
||||
void change_value (property_values_id_type from, property_values_id_type to);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Gets the properties set from a properties set ID
|
||||
*/
|
||||
const PropertiesSet &properties (db::properties_id_type id);
|
||||
DB_PUBLIC const PropertiesSet &properties (db::properties_id_type id);
|
||||
|
||||
/**
|
||||
* @brief Gets the properties ID from a properties set
|
||||
*/
|
||||
db::properties_id_type properties_id (const PropertiesSet &ps);
|
||||
DB_PUBLIC db::properties_id_type properties_id (const PropertiesSet &ps);
|
||||
|
||||
/**
|
||||
* @brief The properties repository
|
||||
|
|
@ -259,32 +313,6 @@ public:
|
|||
*/
|
||||
property_names_id_type prop_value_id (const tl::Variant &name);
|
||||
|
||||
/**
|
||||
* @brief Change the name associated with a given name ID to another name
|
||||
*
|
||||
* All properties with the given name ID will get the new name. This method is
|
||||
* particular useful for the OASIS reader, which may associate a name with an Id
|
||||
* at a late stage. The ID must have been obtained by "allocate_name".
|
||||
*
|
||||
* This method will change the definition of property sets. The ID of the
|
||||
* sets will stay the same. Basically this can lead to a situation where
|
||||
* identical property sets have different IDs. In other words, ID identity
|
||||
* is a guarantee for property set identity, but different IDs do not
|
||||
* mean different property sets.
|
||||
*
|
||||
* The original ID is still valid, but not associated with the new name.
|
||||
*/
|
||||
void change_name (property_names_id_type id, const tl::Variant &new_name);
|
||||
|
||||
/**
|
||||
* @brief Change the name associated with a given name Id to another name
|
||||
*
|
||||
* See "change_name" for more details. This method will change the definition
|
||||
* of the value behind ID to the new value. The ID must have been obtained
|
||||
* through "allocate_value".
|
||||
*/
|
||||
void change_value (property_values_id_type id, const tl::Variant &new_value);
|
||||
|
||||
/**
|
||||
* @brief Get the ID for a name
|
||||
*
|
||||
|
|
@ -341,33 +369,6 @@ public:
|
|||
*/
|
||||
bool is_valid_property_values_id (property_values_id_type id) const;
|
||||
|
||||
/**
|
||||
* @brief Allocates a new properties ID
|
||||
*
|
||||
* This method is intended for filling the properties later, i.e. with "change_properties".
|
||||
* Only after using "change_properties", the properties ID will be found when
|
||||
* looking it up.
|
||||
*/
|
||||
properties_id_type allocate_properties ();
|
||||
|
||||
/**
|
||||
* @brief Allocates a new properties name ID
|
||||
*
|
||||
* This method is intended for filling the properties later, i.e. with "change_name".
|
||||
* Only after using "change_name", a property names ID will be found when
|
||||
* looking up the name.
|
||||
*/
|
||||
property_names_id_type allocate_property_names_id ();
|
||||
|
||||
/**
|
||||
* @brief Allocates a new properties value ID
|
||||
*
|
||||
* This method is intended for filling the properties later, i.e. with "change_value".
|
||||
* Only after using "change_value", the property value ID will be found when
|
||||
* looking up the value.
|
||||
*/
|
||||
property_names_id_type allocate_property_values_id ();
|
||||
|
||||
/**
|
||||
* @brief Lookup a table of properties id's by a name value pair
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3406,15 +3406,14 @@ PartialService::handle_guiding_shape_changes ()
|
|||
parent_inst = s->first.back ().inst_ptr;
|
||||
}
|
||||
|
||||
db::property_names_id_type pn = layout->properties_repository ().prop_name_id ("name");
|
||||
|
||||
const db::PropertiesRepository::properties_set &input_props = layout->properties_repository ().properties (s->first.shape ().prop_id ());
|
||||
db::PropertiesRepository::properties_set::const_iterator input_pv = input_props.find (pn);
|
||||
if (input_pv == input_props.end ()) {
|
||||
// @@@ name by id, don't repeat key
|
||||
const db::PropertiesSet &input_props = db::properties (s->first.shape ().prop_id ());
|
||||
tl::Variant name_value = input_props.value (tl::Variant ("name"));
|
||||
if (name_value.is_nil ()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string shape_name = input_pv->second.to_string ();
|
||||
std::string shape_name = name_value.to_string ();
|
||||
|
||||
// Hint: get_parameters_from_pcell_and_guiding_shapes invalidates the shapes because it resets the changed
|
||||
// guiding shapes. We must not access s->shape after that.
|
||||
|
|
@ -3431,17 +3430,14 @@ PartialService::handle_guiding_shape_changes ()
|
|||
// try to identify the selected shape in the new shapes and select this one
|
||||
db::Shapes::shape_iterator sh = layout->cell (new_inst.cell_index ()).shapes (layout->guiding_shape_layer ()).begin (db::ShapeIterator::All);
|
||||
while (! sh.at_end ()) {
|
||||
const db::PropertiesRepository::properties_set &props = layout->properties_repository ().properties (sh->prop_id ());
|
||||
db::PropertiesRepository::properties_set::const_iterator pv = props.find (pn);
|
||||
if (pv != props.end ()) {
|
||||
if (pv->second.to_string () == shape_name) {
|
||||
lay::ObjectInstPath inst_path = s->first;
|
||||
inst_path.back ().inst_ptr = new_inst;
|
||||
inst_path.back ().array_inst = new_inst.begin ();
|
||||
inst_path.set_shape (*sh);
|
||||
new_sel.insert (std::make_pair (inst_path, s->second));
|
||||
break;
|
||||
}
|
||||
const db::PropertiesSet &props = db::properties (sh->prop_id ());
|
||||
if (props.value (tl::Variant ("name")) == shape_name) {
|
||||
lay::ObjectInstPath inst_path = s->first;
|
||||
inst_path.back ().inst_ptr = new_inst;
|
||||
inst_path.back ().array_inst = new_inst.begin ();
|
||||
inst_path.set_shape (*sh);
|
||||
new_sel.insert (std::make_pair (inst_path, s->second));
|
||||
break;
|
||||
}
|
||||
++sh;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1898,15 +1898,14 @@ Service::handle_guiding_shape_changes (const lay::ObjectInstPath &obj) const
|
|||
parent_inst = obj.back ().inst_ptr;
|
||||
}
|
||||
|
||||
db::property_names_id_type pn = layout->properties_repository ().prop_name_id ("name");
|
||||
db::property_names_id_type pn = db::property_names_id ("name");
|
||||
|
||||
const db::PropertiesRepository::properties_set &input_props = layout->properties_repository ().properties (obj.shape ().prop_id ());
|
||||
db::PropertiesRepository::properties_set::const_iterator input_pv = input_props.find (pn);
|
||||
if (input_pv == input_props.end ()) {
|
||||
const db::PropertiesSet &input_props = db::properties (obj.shape ().prop_id ());
|
||||
if (! input_props.has_value (pn)) {
|
||||
return std::make_pair (false, lay::ObjectInstPath ());
|
||||
}
|
||||
|
||||
std::string shape_name = input_pv->second.to_string ();
|
||||
std::string shape_name = input_props.value (pn).to_string ();
|
||||
|
||||
// Hint: get_parameters_from_pcell_and_guiding_shapes invalidates the shapes because it resets the changed
|
||||
// guiding shapes. We must not access s->shape after that.
|
||||
|
|
@ -1924,15 +1923,12 @@ Service::handle_guiding_shape_changes (const lay::ObjectInstPath &obj) const
|
|||
// try to identify the selected shape in the new shapes and select this one
|
||||
db::Shapes::shape_iterator sh = layout->cell (new_inst.cell_index ()).shapes (layout->guiding_shape_layer ()).begin (db::ShapeIterator::All);
|
||||
while (! sh.at_end () && !found) {
|
||||
const db::PropertiesRepository::properties_set &props = layout->properties_repository ().properties (sh->prop_id ());
|
||||
db::PropertiesRepository::properties_set::const_iterator pv = props.find (pn);
|
||||
if (pv != props.end ()) {
|
||||
if (pv->second.to_string () == shape_name) {
|
||||
new_obj.back ().inst_ptr = new_inst;
|
||||
new_obj.back ().array_inst = new_inst.begin ();
|
||||
new_obj.set_shape (*sh);
|
||||
found = true;
|
||||
}
|
||||
const db::PropertiesSet &props = db::properties (sh->prop_id ());
|
||||
if (props.has_value (pn) && props.value (pn).to_string () == shape_name) {
|
||||
new_obj.back ().inst_ptr = new_inst;
|
||||
new_obj.back ().array_inst = new_inst.begin ();
|
||||
new_obj.set_shape (*sh);
|
||||
found = true;
|
||||
}
|
||||
++sh;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,8 +176,8 @@ get_parameters_from_pcell_and_guiding_shapes (db::Layout *layout, db::cell_index
|
|||
pname_map.insert (std::make_pair (pcp [i].get_name (), i));
|
||||
}
|
||||
|
||||
db::property_names_id_type pn = layout->properties_repository ().prop_name_id ("name");
|
||||
db::property_names_id_type dn = layout->properties_repository ().prop_name_id (tl::Variant ("description"));
|
||||
db::property_names_id_type pn = db::property_names_id ("name");
|
||||
db::property_names_id_type dn = db::property_names_id ("description");
|
||||
|
||||
db::Shapes &guiding_shapes = layout->cell (cell_index).shapes (layout->guiding_shape_layer ());
|
||||
|
||||
|
|
@ -186,11 +186,10 @@ get_parameters_from_pcell_and_guiding_shapes (db::Layout *layout, db::cell_index
|
|||
|
||||
if (sh->has_prop_id ()) {
|
||||
|
||||
const db::PropertiesRepository::properties_set &props = layout->properties_repository ().properties (sh->prop_id ());
|
||||
db::PropertiesRepository::properties_set::const_iterator pv = props.find (pn);
|
||||
if (pv != props.end ()) {
|
||||
const db::PropertiesSet &props = db::properties (sh->prop_id ());
|
||||
if (props.has_value (pn)) {
|
||||
|
||||
std::map <std::string, size_t>::const_iterator pnm = pname_map.find (pv->second.to_string ());
|
||||
std::map <std::string, size_t>::const_iterator pnm = pname_map.find (props.value (pn).to_string ());
|
||||
if (pnm != pname_map.end ()) {
|
||||
|
||||
db::CplxTrans dbu_trans (layout->dbu ());
|
||||
|
|
@ -230,37 +229,37 @@ get_parameters_from_pcell_and_guiding_shapes (db::Layout *layout, db::cell_index
|
|||
if (pd.get_type () == db::PCellParameterDeclaration::t_shape && ! pd.is_hidden ()) {
|
||||
|
||||
// use property with name "name" to indicate the parameter name
|
||||
db::PropertiesRepository::properties_set props;
|
||||
props.insert (std::make_pair (pn, tl::Variant (pd.get_name ())));
|
||||
db::PropertiesSet props;
|
||||
props.insert (pn, tl::Variant (pd.get_name ()));
|
||||
|
||||
if (! pd.get_description ().empty ()) {
|
||||
props.insert (std::make_pair (dn, tl::Variant (pd.get_description ())));
|
||||
props.insert (dn, tl::Variant (pd.get_description ()));
|
||||
}
|
||||
|
||||
if (org_parameters[i].is_user<db::DBox> ()) {
|
||||
|
||||
guiding_shapes.insert (db::BoxWithProperties(db::Box (org_parameters[i].to_user<db::DBox> () * (1.0 / layout->dbu ())), layout->properties_repository ().properties_id (props)));
|
||||
guiding_shapes.insert (db::BoxWithProperties (db::Box (org_parameters[i].to_user<db::DBox> () * (1.0 / layout->dbu ())), db::properties_id (props)));
|
||||
|
||||
} else if (org_parameters[i].is_user<db::DEdge> ()) {
|
||||
|
||||
guiding_shapes.insert (db::EdgeWithProperties(db::Edge (org_parameters[i].to_user<db::DEdge> () * (1.0 / layout->dbu ())), layout->properties_repository ().properties_id (props)));
|
||||
guiding_shapes.insert (db::EdgeWithProperties (db::Edge (org_parameters[i].to_user<db::DEdge> () * (1.0 / layout->dbu ())), db::properties_id (props)));
|
||||
|
||||
} else if (org_parameters[i].is_user<db::DPoint> ()) {
|
||||
|
||||
db::DPoint p = org_parameters[i].to_user<db::DPoint> ();
|
||||
guiding_shapes.insert (db::PointWithProperties(db::Point (p * (1.0 / layout->dbu ())), layout->properties_repository ().properties_id (props)));
|
||||
guiding_shapes.insert (db::PointWithProperties (db::Point (p * (1.0 / layout->dbu ())), db::properties_id (props)));
|
||||
|
||||
} else if (org_parameters[i].is_user<db::DPolygon> ()) {
|
||||
|
||||
db::complex_trans<db::DCoord, db::Coord> dbu_trans (1.0 / layout->dbu ());
|
||||
// Hint: we don't compress the polygon since we don't want to loose information
|
||||
db::Polygon poly = org_parameters[i].to_user<db::DPolygon> ().transformed (dbu_trans, false);
|
||||
guiding_shapes.insert (db::PolygonWithProperties(poly, layout->properties_repository ().properties_id (props)));
|
||||
guiding_shapes.insert (db::PolygonWithProperties (poly, db::properties_id (props)));
|
||||
|
||||
} else if (org_parameters[i].is_user<db::DPath> ()) {
|
||||
|
||||
db::complex_trans<db::DCoord, db::Coord> dbu_trans (1.0 / layout->dbu ());
|
||||
guiding_shapes.insert (db::PathWithProperties(dbu_trans * org_parameters[i].to_user<db::DPath> (), layout->properties_repository ().properties_id (props)));
|
||||
guiding_shapes.insert (db::PathWithProperties (dbu_trans * org_parameters[i].to_user<db::DPath> (), db::properties_id (props)));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue