Constant declaration#

class ansys.scadeone.core.swan.ConstDecl(id: Identifier, type: TypeExpression | None, value: Expression | None = None, pragmas: list[Pragma] | None = None)#

Bases: Declaration

Constant declaration, with an id, a type, and an optional expression.

get_full_path() str#

Full path of Swan construct.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property id: Identifier#

Language item identifier.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.

property pragmas: List[Pragma]#

List of pragmas.

property type: TypeExpression | None#

Type of constant.

property value: Expression | None#

Constant optional value. None if undefined.

class ansys.scadeone.core.swan.ConstDeclarations(constants: List[ConstDecl])#

Bases: GlobalDeclaration

Constant declarations: constant {{ constant_decl ; }}.

get_full_path() str#

Full path of Swan construct.

static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem], None]

Items to set owner.

property constants: List[ConstDecl]#

Declared constants.

property is_protected: bool#

Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).

property model: IModel#

Return model containing the Swan item.

property module: ModuleBase | None#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface or None if the object is itself a module.

property owner: SwanItem | IModel | None#

Owner of current Swan construct.