API reference - Class DeviceClass

Notation used in Ruby API documentation

Module: db

Description: A class describing a specific type of device.

Device class objects live in the context of a Netlist object. After a device class is created, it must be added to the netlist using Netlist#add. The netlist will own the device class object. When the netlist is destroyed, the device class object will become invalid.

The DeviceClass class is the base class for other device classes.

This class has been added in version 0.26.

Public constructors

new DeviceClass ptrnewCreates a new object of this class

Public methods

void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
voidassign(const DeviceClass other)Assigns another object to self
[const]stringdescriptionGets the description text of the device class.
voiddescription=(string description)Sets the description of the device class.
[const]new DeviceClass ptrdupCreates a copy of self
EqualDeviceParameters ptrequal_parametersGets the device parameter comparer for netlist verification or nil if no comparer is registered.
voidequal_parameters=(EqualDeviceParameters ptr comparer)Specifies a device parameter comparer for netlist verification.
[const]boolhas_parameter?(string name)Returns true, if the device class has a parameter with the given name.
[const]boolhas_terminal?(string name)Returns true, if the device class has a terminal with the given name.
[const]unsigned longidGets the unique ID of the device class
[const]stringnameGets the name of the device class.
voidname=(string name)Sets the name of the device class.
Netlist ptrnetlistGets the netlist the device class lives in.
[const]const DeviceParameterDefinition ptrparameter_definition(unsigned long parameter_id)Gets the parameter definition object for a given ID.
[const]DeviceParameterDefinition[]parameter_definitionsGets the list of parameter definitions of the device.
[const]unsigned longparameter_id(string name)Returns the parameter ID of the parameter with the given name.
voidstrict=(bool s)Sets a value indicating whether this class performs strict terminal mapping
[const]boolstrict?Gets a value indicating whether this class performs strict terminal mapping
[const]const DeviceTerminalDefinition ptrterminal_definition(unsigned long terminal_id)Gets the terminal definition object for a given ID.
[const]DeviceTerminalDefinition[]terminal_definitionsGets the list of terminal definitions of the device.
[const]unsigned longterminal_id(string name)Returns the terminal ID of the terminal with the given name.

Deprecated methods (protected, public, static, non-static and constructors)

voidcreateUse of this method is deprecated. Use _create instead
voiddestroyUse of this method is deprecated. Use _destroy instead
[const]booldestroyed?Use of this method is deprecated. Use _destroyed? instead
[const]boolis_const_object?Use of this method is deprecated. Use _is_const_object? instead

Detailed description

_create

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

_destroy

Signature: void _destroy

Description: Explicitly destroys the object

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

_destroyed?

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

_is_const_object?

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

_manage

Signature: void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

_unmanage

Signature: void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

assign

Signature: void assign (const DeviceClass other)

Description: Assigns another object to self

create

Signature: void create

Description: Ensures the C++ object is created

Use of this method is deprecated. Use _create instead

description

Signature: [const] string description

Description: Gets the description text of the device class.

Python specific notes:
The object exposes a readable attribute 'description'. This is the getter.

description=

Signature: void description= (string description)

Description: Sets the description of the device class.

Python specific notes:
The object exposes a writable attribute 'description'. This is the setter.

destroy

Signature: void destroy

Description: Explicitly destroys the object

Use of this method is deprecated. Use _destroy instead

destroyed?

Signature: [const] bool destroyed?

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

Use of this method is deprecated. Use _destroyed? instead

dup

Signature: [const] new DeviceClass ptr dup

Description: Creates a copy of self

equal_parameters

Signature: EqualDeviceParameters ptr equal_parameters

Description: Gets the device parameter comparer for netlist verification or nil if no comparer is registered.

See equal_parameters= for the setter.

This getter has been introduced in version 0.26.4.

Python specific notes:
The object exposes a readable attribute 'equal_parameters'. This is the getter.

equal_parameters=

Signature: void equal_parameters= (EqualDeviceParameters ptr comparer)

Description: Specifies a device parameter comparer for netlist verification.

By default, all devices are compared with all parameters. If you want to select only certain parameters for comparison or use a fuzzy compare criterion, use an EqualDeviceParameters object and assign it to the device class of one netlist. You can also chain multiple EqualDeviceParameters objects with the '+' operator for specifying multiple parameters in the equality check.

You can assign nil for the parameter comparer to remove it.

In special cases, you can even implement a custom compare scheme by deriving your own comparer from the GenericDeviceParameterCompare class.

Python specific notes:
The object exposes a writable attribute 'equal_parameters'. This is the setter.

has_parameter?

Signature: [const] bool has_parameter? (string name)

Description: Returns true, if the device class has a parameter with the given name.

has_terminal?

Signature: [const] bool has_terminal? (string name)

Description: Returns true, if the device class has a terminal with the given name.

id

Signature: [const] unsigned long id

Description: Gets the unique ID of the device class

The ID is a unique integer that identifies the device class. Use the ID to check for object identity - i.e. to determine whether two devices share the same device class.

is_const_object?

Signature: [const] bool is_const_object?

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

Use of this method is deprecated. Use _is_const_object? instead

name

Signature: [const] string name

Description: Gets the name of the device class.

Python specific notes:
The object exposes a readable attribute 'name'. This is the getter.

name=

Signature: void name= (string name)

Description: Sets the name of the device class.

Python specific notes:
The object exposes a writable attribute 'name'. This is the setter.

netlist

Signature: Netlist ptr netlist

Description: Gets the netlist the device class lives in.

new

Signature: [static] new DeviceClass ptr new

Description: Creates a new object of this class

Python specific notes:
This method is the default initializer of the object

parameter_definition

Signature: [const] const DeviceParameterDefinition ptr parameter_definition (unsigned long parameter_id)

Description: Gets the parameter definition object for a given ID.

Parameter definition IDs are used in some places to reference a specific parameter of a device. This method obtains the corresponding definition object.

parameter_definitions

Signature: [const] DeviceParameterDefinition[] parameter_definitions

Description: Gets the list of parameter definitions of the device.

See the DeviceParameterDefinition class description for details.

parameter_id

Signature: [const] unsigned long parameter_id (string name)

Description: Returns the parameter ID of the parameter with the given name.

An exception is thrown if there is no parameter with the given name. Use has_parameter to check whether the name is a valid parameter name.

strict=

Signature: void strict= (bool s)

Description: Sets a value indicating whether this class performs strict terminal mapping

Classes with this flag set never allow terminal swapping, even if the device symmetry supports that. If two classes are involved in a netlist compare, terminal swapping will be disabled if one of the classes is in strict mode.

By default, device classes are not strict and terminal swapping is allowed as far as the device symmetry supports that.

Python specific notes:
The object exposes a writable attribute 'strict'. This is the setter.

strict?

Signature: [const] bool strict?

Description: Gets a value indicating whether this class performs strict terminal mapping

See strict= for details about this attribute.

Python specific notes:
The object exposes a readable attribute 'strict'. This is the getter.

terminal_definition

Signature: [const] const DeviceTerminalDefinition ptr terminal_definition (unsigned long terminal_id)

Description: Gets the terminal definition object for a given ID.

Terminal definition IDs are used in some places to reference a specific terminal of a device. This method obtains the corresponding definition object.

terminal_definitions

Signature: [const] DeviceTerminalDefinition[] terminal_definitions

Description: Gets the list of terminal definitions of the device.

See the DeviceTerminalDefinition class description for details.

terminal_id

Signature: [const] unsigned long terminal_id (string name)

Description: Returns the terminal ID of the terminal with the given name.

An exception is thrown if there is no terminal with the given name. Use has_terminal to check whether the name is a valid terminal name.