Class Layout (version 0.18)

Description: The layout object

The layout object basically wraps the cell graphs and adds functionality for managing cell names and layer names. The cell graph is a container for the cells and their hierarchical arrangement. The cell graph is constructed by creating cells and adding child instances to it.

Class overview

Index

Method Overview

unsigned int properties_id( properties[ ] )Get the properties ID for a given properties set
[const] [ ] properties( unsigned int properties_id )Get the properties set for a given properties ID
bool has_cell?( string name )Tell, if the cell with a given name exists
unsigned int cell_by_name( string name )Get the cell index for a given name
[const] string cell_name( unsigned int index )Get the name for a cell with the given index
unsigned int add_cell( string name )Add a cell with the given name
rename_cell( unsigned int index, string name )Rename the cell with the given index to the given name
start_changesSignal the start of an operation bringing the layout into invalid state
end_changesCancel the "in changes" state (see "start_changes")
[const] bool under_constructionTell if the layout object is under construction
updateUpdate the internals of the layout
dbu=( double dbu )Database unit write accessor
[const] double dbuDatabase unit read accessor
unsigned int insert_layer( LayerInfo props )Insert a new layer with the given properties
insert_layer_at( unsigned int index, LayerInfo props )Insert a new layer with the given properties at the given index
unsigned int insert_special_layer( LayerInfo props )Insert a new special layer with the given properties
insert_special_layer_at( unsigned int index, LayerInfo props )Insert a new special layer with the given properties at the given index
set_info( unsigned int index, LayerInfo props )Set the info structure for a specified layer
[const] const ref LayerInfo get_info( unsigned int index )Get the info structure for a specified layer
[const] unsigned int cellsReturn the number of cells
ref Cell cell( unsigned int i )Address a cell by index
yield ref Cell each_cellIterate the unsorted cell list
yield unsigned int each_cell_bottom_upIterate the bottom-up sorted cell list
yield unsigned int each_cell_top_downIterate of the top-down sorted cell list
yield unsigned int each_top_cellIterate the top cells
delete_layer( unsigned int layer_index )Delete a layer
[const] unsigned int layersReturn the number of layers
[const] bool is_valid_layer?( unsigned int layer_index )Tell, if a layer index is a valid index
[const] bool is_special_layer?( unsigned int layer_index )Tell, if a layer index is a special layer index
[const] RecursiveShapeIterator begin_shapes( unsigned int cell_index, unsigned int layer )Delivers a recursive shape iterator for the shapes below the given cell on the given layer
[const] RecursiveShapeIterator begin_shapes_touching( unsigned int cell_index, unsigned int layer, Box region )Delivers a recursive shape iterator for the shapes below the given cell on the given layer using a region search
[const] RecursiveShapeIterator begin_shapes_overlapping( unsigned int cell_index, unsigned int layer, Box region )Delivers a recursive shape iterator for the shapes below the given cell on the given layer using a region search
[const] write( string filename, bool gzip, SaveLayoutOptions options )Write the layout to a stream file
LayerMap read( string filename )Load the layout from the given file
LayerMap read( string filename, LoadLayoutOptions options )Load the layout from the given file with options
destroyExplicitly destroy the object
[const] bool destroyedTell, if the object was destroyed

unsigned int add_cell( string name )

Description: Add a cell with the given name

returns:The index of the newly created cell.

[const] RecursiveShapeIterator begin_shapes( unsigned int cell_index, unsigned int layer )

Description: Delivers a recursive shape iterator for the shapes below the given cell on the given layer

For details see the description of the RecursiveShapeIterator class.

This method has been added in version 0.18.

cell_index:The index of the starting cell
layer:The layer from which to get the shapes
returns:A suitable iterator

[const] RecursiveShapeIterator begin_shapes_overlapping( unsigned int cell_index, unsigned int layer, Box region )

Description: Delivers a recursive shape iterator for the shapes below the given cell on the given layer using a region search

For details see the description of the RecursiveShapeIterator class. This version gives an iterator delivering shapes whose bounding box overlaps the given region.

This method has been added in version 0.18.

cell_index:The index of the starting cell
layer:The layer from which to get the shapes
region:The search region
returns:A suitable iterator

[const] RecursiveShapeIterator begin_shapes_touching( unsigned int cell_index, unsigned int layer, Box region )

Description: Delivers a recursive shape iterator for the shapes below the given cell on the given layer using a region search

For details see the description of the RecursiveShapeIterator class. This version gives an iterator delivering shapes whose bounding box touches the given region.

This method has been added in version 0.18.

cell_index:The index of the starting cell
layer:The layer from which to get the shapes
region:The search region
returns:A suitable iterator

ref Cell cell( unsigned int i )

Description: Address a cell by index

i:The cell index
returns:A reference to the cell

unsigned int cell_by_name( string name )

Description: Get the cell index for a given name

Returns the cell index for the cell with the given name. If no cell with this name exists, an exception is thrown.

[const] string cell_name( unsigned int index )

Description: Get the name for a cell with the given index

[const] unsigned int cells

Description: Return the number of cells

returns:The number of cells (the maximum cell index)

[const] double dbu

Description: Database unit read accessor

dbu=( double dbu )

Description: Database unit write accessor

delete_layer( unsigned int layer_index )

Description: Delete a layer

This does free the shapes of the cells and remembers the layer's index for recycling.

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: Tell, if the object was 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.

yield ref Cell each_cell

Description: Iterate the unsorted cell list

yield unsigned int each_cell_bottom_up

Description: Iterate the bottom-up sorted cell list

In bottom-up traversal a cell is not delivered before the last child cell of this cell has been delivered. The bottom-up iterator does not deliver cells but cell indices actually.

yield unsigned int each_cell_top_down

Description: Iterate of the top-down sorted cell list

The top-down cell list has the property of delivering all cells before they are instantiated. In addition the first cells are all top cells. There is at least one top cell. The top-down iterator does not deliver cells but cell indices actually.

yield unsigned int each_top_cell

Description: Iterate the top cells

A layout may have an arbitrary number of top cells. The usual case however is that there is one top cell.

end_changes

Description: Cancel the "in changes" state (see "start_changes")

[const] const ref LayerInfo get_info( unsigned int index )

Description: Get the info structure for a specified layer

bool has_cell?( string name )

Description: Tell, if the cell with a given name exists

Returns true, if the layout has a cell with the given name

unsigned int insert_layer( LayerInfo props )

Description: Insert a new layer with the given properties

returns:The index of the newly created layer

insert_layer_at( unsigned int index, LayerInfo props )

Description: Insert a new layer with the given properties at the given index

unsigned int insert_special_layer( LayerInfo props )

Description: Insert a new special layer with the given properties

Special layers can be used to represent objects that should not participate in normal viewing or other related operations. Special layers are not reported as valid layers.

returns:The index of the newly created layer

insert_special_layer_at( unsigned int index, LayerInfo props )

Description: Insert a new special layer with the given properties at the given index

See insert_special_layer for a description of special layers.

[const] bool is_special_layer?( unsigned int layer_index )

Description: Tell, if a layer index is a special layer index

returns:true, if this is so

[const] bool is_valid_layer?( unsigned int layer_index )

Description: Tell, if a layer index is a valid index

returns:true, if this is so

[const] unsigned int layers

Description: Return the number of layers

The number of layers reports the maximum (plus 1) layer index used so far. Not all of the layers with an index in the range of 0 to layers-1 needs to be a valid layer. These layers can be either valid, special or unused. Use is_valid_layer? and is_special_layer? to test for the first two states.

[const] [ ] properties( unsigned int properties_id )

Description: Get the properties set for a given properties ID

Basically performs the backward conversion of the 'properties_id' method. Given a properties ID, returns the properties set as an array of pairs of variants. In this array, each key and the value are stored as pairs (arrays with two elements). If the properties ID is not valid, an empty array is returned.

properties_id:The properties ID to get the properties for
returns:The array of variants (see properties_id)

unsigned int properties_id( properties[ ] )

Description: Get the properties ID for a given properties set

Before a set of properties can be attached to a shape, it must be converted into an ID that is unique for that set. The properties set must be given as a list of pairs of variants, each pair describing a name and a value. The name acts as the key for the property and does not need to be a string (it can be an integer or double value as well). The backward conversion can be performed with the 'properties' method.

properties:The array of pairs of variants (both elements can be integer, double or string)
returns:The unique properties ID for that set

LayerMap read( string filename )

Description: Load the layout from the given file

The format of the file is determined automatically and automatic unzipping is provided. No particular options can be specified. This method has been added in version 0.18.

filename:The name of the file to load.
returns:A layer map that contains the mapping used by the reader including the layers that have been created.

LayerMap read( string filename, LoadLayoutOptions options )

Description: Load the layout from the given file with options

The format of the file is determined automatically and automatic unzipping is provided. In this version, some reader options can be specified. This method has been added in version 0.18.

filename:The name of the file to load.
options:The options object specifying further options for the reader.
returns:A layer map that contains the mapping used by the reader including the layers that have been created.

rename_cell( unsigned int index, string name )

Description: Rename the cell with the given index to the given name

set_info( unsigned int index, LayerInfo props )

Description: Set the info structure for a specified layer

start_changes

Description: Signal the start of an operation bringing the layout into invalid state

This method should be called whenever the layout is about to be brought into an invalid state. After calling this method, under_construction returns false which tells foreign code (such as update which might be called asynchroneously for example because of a repaint event) not to use this layout object.

This state is cancelled by the end_changes method. The start_changes method can be called multiple times and must be cancelled the same number of times.

Using this method is only required currently if a repaint event may happen while the layout object is in an invalid state.

[const] bool under_construction

Description: Tell if the layout object is under construction

A layout object is either under construction if a transaction is ongoing or the layout is brought into invalid state by "start_changes".

update

Description: Update the internals of the layout

This method updates the internal state of the layout. Usually this is done automatically This method is provided to ensure this state explicitly.

[const] write( string filename, bool gzip, SaveLayoutOptions options )

Description: Write the layout to a stream file

filename:The file to which to write the layout
gzip:True, if the file should be gzipped
options:The option set to use for writing. See SaveLayoutOptions for details