API reference - Class LayerInfo

Notation used in Ruby API documentation

Description: A structure encapsulating the layer properties

The layer properties describe how a layer is stored in a GDS2 or OASIS file for example. The LayerInfo object represents the storage properties that are attached to a layer in the database.

In general, a layer has either a layer and a datatype number (in GDS2), a name (for example in DXF or CIF) or both (in OASIS). In the latter case, the primary identification is through layer and datatype number and the name is some annotation attached to it. A LayerInfo object which specifies just a name returns true on is_named?. The LayerInfo object can also specify an anonymous layer (use LayerInfo#new without arguments). Such a layer will not be stored when saving the layout. They can be employed for temporary layers for example. Use LayerInfo#anonymous? to test whether a layer does not have a specification.

The LayerInfo is used for example in Layout#insert_layer to specify the properties of the new layer that will be created. The is_equivalent? method compares two LayerInfo objects using the layer and datatype numbers with a higher priority over the name.

Public constructors

new LayerInfonewThe default constructor.
new LayerInfonew(int layer,
int datatype)
The constructor for a layer/datatype pair.
new LayerInfonew(string name)The constructor for a named layer.
new LayerInfonew(int layer,
int datatype,
string name)
The constructor for a named layer with layer and datatype.

Public methods

[const]bool!=(const LayerInfo b)Compare two layer info objects
[const]bool==(const LayerInfo b)Compare two layer info objects
[const]boolanonymous?Returns true, if the layer has no specification (i.e. is created by the default constructor).
[const]voidassign(const LayerInfo other)Assign the contents of another object to self
voidcreateEnsures the C++ object is created
[const]intdatatypeGets the datatype
voiddatatype=(int datatype)Set the datatype
voiddestroyExplicitly destroy the object
[const]booldestroyed?Returns a value indicating whether the object was already destroyed
[const]LayerInfodupCreates a copy of self
[const]boolis_const_object?Returns a value indicating whether the reference is a const reference
[const]boolis_equivalent?(const LayerInfo b)Equivalence of two layer info objects
[const]boolis_named?Returns true, if the layer is purely specified by name.
[const]intlayerGets the layer number
voidlayer=(int layer)Sets the layer number
[const]stringnameGets the layer name
voidname=(string name)Set the layer name
[const]stringto_sConvert the layer info object to a string

Public static methods and constants

LayerInfofrom_string(string s)Create a layer info object from a string

Detailed description

[const] bool !=(const LayerInfo b)

Description: Compare two layer info objects

Returns:True, if both are not equal

This method was added in version 0.18.

[const] bool ==(const LayerInfo b)

Description: Compare two layer info objects

Returns:True, if both are equal

This method was added in version 0.18.

[const] bool anonymous?

Description: Returns true, if the layer has no specification (i.e. is created by the default constructor).

Returns:True, if the layer does not have any specification.

This method was added in version 0.23.

[const] void assign(const LayerInfo other)

Description: Assign the contents of another object to self

This method assigns the contents of another object to self. This is a deep copy that does not only copy the reference but the actual content.

void create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

[const] int datatype

Description: Gets the datatype

void datatype=(int datatype)

Description: Set the datatype

void destroy

Description: Explicitly destroy the object

Explicitly destroy the object on C++ side if it was owned by the Ruby interpreter. Subsequent access to this object will throw an exception. If the object is not owned by Ruby, this method will do nothing.

[const] bool destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

[const] LayerInfo dup

Description: Creates a copy of self

[static] LayerInfo from_string(string s)

Description: Create a layer info object from a string

The:string
Returns:The LayerInfo object

This method will take strings as produced by to_s and create a LayerInfo object from them. The format is either "layer", "layer/datatype", "name" or "name (layer/datatype)".

This method was added in version 0.23.

[const] bool is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

[const] bool is_equivalent?(const LayerInfo b)

Description: Equivalence of two layer info objects

Returns:True, if both are equivalent

First, layer and datatype are compared. The name is of second order and used only if no layer or datatype is given. This is basically a weak comparison that reflects the search preferences.

This method was added in version 0.18.

[const] bool is_named?

Description: Returns true, if the layer is purely specified by name.

Returns:True, if no layer or datatype is given.

This method was added in version 0.18.

[const] int layer

Description: Gets the layer number

void layer=(int layer)

Description: Sets the layer number

[const] string name

Description: Gets the layer name

void name=(string name)

Description: Set the layer name

The name is set on OASIS input for example, if the layer has a name.

[static] new LayerInfo new

Description: The default constructor.

Creates a default LayerInfo object.

This method was added in version 0.18.

[static] new LayerInfo new(int layer,int datatype)

Description: The constructor for a layer/datatype pair.

layer:The layer number
datatype:The datatype number

Creates a LayerInfo object representing a layer and datatype.

This method was added in version 0.18.

[static] new LayerInfo new(string name)

Description: The constructor for a named layer.

name:The name

Creates a LayerInfo object representing a named layer.

This method was added in version 0.18.

[static] new LayerInfo new(int layer,int datatype,string name)

Description: The constructor for a named layer with layer and datatype.

layer:The layer number
datatype:The datatype number
name:The name

Creates a LayerInfo object representing a named layer with layer and datatype.

This method was added in version 0.18.

[const] string to_s

Description: Convert the layer info object to a string

Returns:The string

This method was added in version 0.18.