DFDefine¶
DFDefine is used to create a named constant value which can be used by the design implementation so that constants are guaranteed to be consistent.
As with every tag, DFDefine inherits from DFBase, so has support for all of the core attributes (id, description, and attributes).
{
"id": "my_block_id",
"description": "The bus ID of my block",
"attributes": { },
"value": 123456
}
| Property | Usage |
|---|---|
| value | The value that the DFDefine represents - can be integer or otherwise |
Python API¶
-
class
designformat.define.DFDefine(id=None, value=None, description=None)¶ Defines a named constant value related to the design.
-
__init__(id=None, value=None, description=None)¶ Constructor for the defined value.
- Parameters
id – Name of the constant
value – Value of the constant (can be integer, or otherwise)
description – Human-readable description of the definition
-
__repr__(depth=0, max_depth=2, max_list=2)¶ Generate an automatic representation of this block when it is converted to a string.
- Parameters
depth – The current depth we’re printing at
max_depth – The maximum depth we should print to
max_list – The maximum number of array or dictionary entries to print
- Returns
Readable representation of this block
- Return type
str
-
__str__()¶ Create a representation of this block
- Returns
Readable representation of this block
- Return type
str
-
dumpObject(project=None)¶ Dump out this node so that it can be reloaded
- Parameters
project – Project definition used to calculate references
-
loadObject(obj, root=None)¶ Reload this node from passed in object.
- Parameters
obj – Description of this node
root – Root object in the tree
-
Javascript API¶
-
class
DFDefine(id, value, description)¶ Defines a named constant value related to the design.
Constructor for the defined value.
- Arguments
id (string) – Name of the constant
value (any) – Value of the constant (can be integer, or otherwise)
description (string) – Human-readable description of the definition