Class Layout (version 0.20)

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

[static] Layout new( ref Manager )Create a layout object attached to a manager
[static] Layout newCreate a layout object
clearClears the layout
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 )name
delete_cell( unsigned int cell_index )Delete a cell
delete_cells( unsigned int cell_index_list[ ] )Delete multiple cells
prune_subcells( unsigned int cell_index, int levels )Delete all sub cells of the cell which are not used otherwise down to the specified level of hierarchy
prune_cell( unsigned int cell_index, int levels )Delete a cell plus subcells not used otherwise
delete_cell_rec( unsigned int cell_index )Delete a cell plus all subcells
flatten( unsigned int cell_index, int levels, bool prune )Flatten the given cell
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
swap_layers( unsigned int a, unsigned int b )Swap layers
move_layer( unsigned int src, unsigned int dest )Move a layer
copy_layer( unsigned int src, unsigned int dest )Copy a layer
clear_layer( unsigned int layer_index )Clear a layer
delete_layer( unsigned int layer_index )Delete a layer
[const] unsigned int[ ] layer_indicesReturn a list of valid layer indices
[const] unsigned int layersReturn the number of layers
[const] bool is_valid_cell_index?( unsigned int cell_index )Tell, if a cell index is a valid index
[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
[const] write( string filename )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
assign( Layout other )Assign the contents of another object to self
[const] Layout dupCreates a copy of self.
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.

assign( Layout 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.

[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)

clear

Description: Clears the layout

Clears the layout completely.

clear_layer( unsigned int layer_index )

Description: Clear a layer

Clears the layer: removes all shapes.

This method was introduced in version 0.19.

layer_index:The index of the layer to delete.

copy_layer( unsigned int src, unsigned int dest )

Description: Copy a layer

This method was introduced in version 0.19.

Copy a layer from the source to the target. The target is not cleared before, so that this method merges shapes from the source with the target layer.

src:The layer index of the source layer.
dest:The layer index of the destination layer.

[const] double dbu

Description: Database unit read accessor

dbu=( double dbu )

Description: Database unit write accessor

delete_cell( unsigned int cell_index )

Description: Delete a cell

This deletes a cell but not the sub cells of the cell. These subcells will likely become new top cells unless they are used otherwise. All instances of this cell are deleted as well. Hint: to delete multiple cells, use "delete_cells" which is far more efficient in this case.

This method has been introduced in version 0.20.

cell_index:The index of the cell to delete

delete_cell_rec( unsigned int cell_index )

Description: Delete a cell plus all subcells

This deletes a cell and also all sub cells of the cell. In contrast to prune_cell, all cells are deleted together with their instances even if they are used otherwise.

This method has been introduced in version 0.20.

cell_index:The index of the cell to delete

delete_cells( unsigned int cell_index_list[ ] )

Description: Delete multiple cells

This deletes the cells but not the sub cells of these cells. These subcells will likely become new top cells unless they are used otherwise. All instances of these cells are deleted as well.

This method has been introduced in version 0.20.

cell_index_list:An array of cell indices of the cells to delete

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.

layer_index:The index of the layer to delete.

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.

[const] Layout dup

Description: Creates a copy of self.

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")

flatten( unsigned int cell_index, int levels, bool prune )

Description: Flatten the given cell

This method propagates all shapes from the specified number of hierarchy levels below into the given cell. It also removes the instances of the cells from which the shapes came from, but does not remove the cells themselves if prune is set to false. If prune is set to true, these cells are removed if not used otherwise.

This method has been introduced in version 0.20.

cell_index:The cell which should be flattened
levels:The number of hierarchy levels to flatten (-1: all, 0: none, 1: one level etc.)
prune:Set to true to remove orphan cells.

[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 the case

[const] bool is_valid_cell_index?( unsigned int cell_index )

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

This method has been added in version 0.20.

returns:true, if this is the case

[const] bool is_valid_layer?( unsigned int layer_index )

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

returns:true, if this is the case

[const] unsigned int[ ] layer_indices

Description: Return a list of valid layer indices

This method returns an array with layer indices representing valid layers.

This method was introduced in version 0.19.

[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.

move_layer( unsigned int src, unsigned int dest )

Description: Move a layer

This method was introduced in version 0.19.

Move a layer from the source to the target. The target is not cleared before, so that this method merges shapes from the source with the target layer. The source layer is empty after that operation.

src:The layer index of the source layer.
dest:The layer index of the destination layer.

[static] Layout new

Description: Create a layout object

[static] Layout new( ref Manager )

Description: Create a layout object attached to a manager

This method was introduced in version 0.19.

[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

prune_cell( unsigned int cell_index, int levels )

Description: Delete a cell plus subcells not used otherwise

This deletes a cell and also all sub cells of the cell which are not used otherwise. The number of hierarchy levels to consider can be specified as well. One level of hierarchy means that only the direct children of the cell are deleted with the cell itself. All instances of this cell are deleted as well.

This method has been introduced in version 0.20.

cell_index:The index of the cell to delete
levels:The number of hierarchy levels to consider (-1: all, 0: none, 1: one level etc.)

prune_subcells( unsigned int cell_index, int levels )

Description: Delete all sub cells of the cell which are not used otherwise down to the specified level of hierarchy

This deletes all sub cells of the cell which are not used otherwise. All instances of the deleted cells are deleted as well. It is possible to specify how many levels of hierarchy below the given root cell are considered.

This method has been introduced in version 0.20.

cell_index:The root cell from which to delete a sub cells
levels:The number of hierarchy levels to consider (-1: all, 0: none, 1: one level etc.)

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: 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 asynchronously 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.

swap_layers( unsigned int a, unsigned int b )

Description: Swap layers

Swaps the shapes of both layers.

This method was introduced in version 0.19.

a:The first of the layers to swap.
b:The second of the layers to swap.

[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

[const] write( string filename )

Description: Write the layout to a stream file

filename:The file to which to write the layout