From ede58ae728fdd7bf75b8b73537d24194fb76e601 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Fri, 24 Feb 2017 22:43:31 +0100 Subject: [PATCH] Added a convenience method to RBA::Layout for creating a temp layer --- src/db/gsiDeclDbLayout.cc | 14 ++++++++++++++ testdata/ruby/dbLayout.rb | 7 ++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/db/gsiDeclDbLayout.cc b/src/db/gsiDeclDbLayout.cc index ad1d6bc93..beae15a6a 100644 --- a/src/db/gsiDeclDbLayout.cc +++ b/src/db/gsiDeclDbLayout.cc @@ -371,6 +371,11 @@ static unsigned int get_layer (db::Layout *l, const db::LayerProperties &lp) } } +static unsigned int get_layer0 (db::Layout *l) +{ + return get_layer (l, db::LayerProperties ()); +} + static unsigned int get_layer1 (db::Layout *l, const std::string &name) { return get_layer (l, db::LayerProperties (name)); @@ -1268,6 +1273,15 @@ Class decl_Layout ("Layout", "You can convert coordinates to micrometers by multiplying the integer value with the database unit.\n" "Typical values for the database unit are 0.001 micrometer (one nanometer).\n" ) + + gsi::method_ext ("layer", &get_layer0, + "@brief Finds or creates a new internal layer\n" + "\n" + "This method will create a new internal layer and return the layer index for this layer.\n" + "The layer does not have any properties attached to it. That means, it is not going to be saved " + "to a layout file unless it is given database properties with \\set_info.\n" + "\n" + "This method has been introduced in version 0.25.\n" + ) + gsi::method_ext ("layer", &get_layer, "@brief Finds or creates a layer with the given properties\n" "@args info\n" diff --git a/testdata/ruby/dbLayout.rb b/testdata/ruby/dbLayout.rb index 28f857e3b..6ab33a27f 100644 --- a/testdata/ruby/dbLayout.rb +++ b/testdata/ruby/dbLayout.rb @@ -162,12 +162,17 @@ class DBLayout_TestClass < TestBase b = ly.layer(RBA::LayerInfo.new(3, 0)) assert_equal(a, b) assert_equal(ll(ly), "3/0") - b = ly.layer(RBA::LayerInfo.new) + bb = b + b = ly.layer assert_equal(ll(ly), "3/0,") + assert_equal(b != bb, true) + bb = b b = ly.layer(RBA::LayerInfo.new) assert_equal(ll(ly), "3/0,,") + assert_equal(b != bb, true) n = ly.layer(RBA::LayerInfo.new ("hallo")); assert_equal(ll(ly), "3/0,,,hallo") + assert_equal(b != n, true) ly = RBA::Layout.new li = ly.layer(2, 0)