KLayout Manual: Main Index » Class Index » API reference - Class PCellDeclarationAPI reference - Class PCellDeclarationNotation used in Ruby API documentation Description: A PCell declaration providing the parameters and code to produce the PCell Class hierarchy: PCellDeclaration A PCell declaration is basically the recipe of how to create a PCell layout from a parameter set. The declaration includes
All these declarations are implemented by deriving from the PCellDeclaration class and reimplementing the specific methods. Reimplementing the display_name method is optional. The default implementation creates a name from the PCell name plus the parameters. By supplying the information about the layers it wants to create, KLayout is able to call the production callback with a defined set of the layer ID's which are already mapped to valid actual layout layers. This class has been introduced in version 0.22. Public constructors
Public methods
Detailed description[const] void assign(const PCellDeclaration 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. [virtual,const] bool can_create_from_shape(const Layout layout,const Shape shape,unsigned int layer)Description: Returns true, if the PCell can be created from the given shape
KLayout offers a way to convert a shape into a PCell. To test whether the PCell can be created from a shape, it will call this method. If this method returns true, KLayout will use parameters_from_shape and transformation_from_shape to derive the parameters and instance transformation for the new PCell instance that will replace the shape. [virtual,const] variant[] coerce_parameters(const Layout layout,variant[] input)Description: Modifies the parameters to match the requirements
This method can be reimplemented to change the parameter set according to some constraints for example. The reimplementation may modify the parameters in a way that they are usable for the produce method. The method receives a reference to the layout so it is able to verify the parameters against layout properties. It can raise an exception to indicate that something is not correct. void createDescription: 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. void destroyDescription: 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. [virtual,const] string display_text(variant[] parameters)Description: Returns the display text for this PCell given a certain parameter set Reimplement this method to create a distinct display text for a PCell variant with the given parameter set. If this method is not implemented, a default text is created. [const] PCellDeclaration dupDescription: Creates a copy of self [virtual,const] LayerInfo[] get_layers(variant[] parameters)Description: Returns a list of layer declarations Reimplement this method to return a list of layers this PCell wants to create. The layer declarations are returned as a list of LayerInfo objects which are used as match expressions to look up the layer in the actual layout. This method receives the PCell parameters which allows it to deduce layers from the parameters. [virtual,const] PCellParameterDeclaration[] get_parametersDescription: Returns a list of parameter declarations Reimplement this method to return a list of parameters used in that PCell implementation. A parameter declaration is a PCellParameterDeclaration object and defines the parameter name, type, description text and possible choices for the parameter value. [const] unsigned int idDescription: Gets the integer ID of the PCell declaration This ID is used to identify the PCell in the context of a Layout object for example [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] string nameDescription: Gets the name of the PCell [static] PCellDeclaration newDescription: Creates a new object of this class [virtual,const] variant[] parameters_from_shape(const Layout layout,const Shape shape,unsigned int layer)Description: Gets the parameters for the PCell which can replace the given shape
KLayout offers a way to convert a shape into a PCell. If can_create_from_shape returns true, it will use this method to derive the parameters for the PCell instance that will replace the shape. See also transformation_from_shape and can_create_from_shape. [virtual,const] void produce(const Layout layout,unsigned int[] layer_ids,variant[] parameters,Cell cell)Description: The production callback
Reimplement this method to provide the code that implements the PCell. The code is supposed to create the layout in the target cell using the provided parameters and the layers passed in the layer_ids list. [virtual,const] Trans transformation_from_shape(const Layout layout,const Shape shape,unsigned int layer)Description: Gets the instance transformation for the PCell which can replace the given shape
KLayout offers a way to convert a shape into a PCell. If can_create_from_shape returns true, it will use this method to derive the transformation for the PCell instance that will replace the shape. See also parameters_from_shape and can_create_from_shape. |