Variable declarations#

class ansys.scadeone.core.swan.VarSection(var_decls: List[VarDecl])#

Bases: ScopeSection

Implements:

var {{var_decl ;}} section.

get_full_path() str#

Full path of Swan construct.

static set_owner(owner: Self, children: Self | Iterable[Self])#

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

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem]]

Items to set owner.

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 is_text: bool#

True when section is given from {text%…%text} markup.

property model: Model#

Return model containing the Swan item.

property module: ModuleBase#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface

property owner: Self#

Owner of current Swan construct.

property var_decls: List[VarDecl]#

Declared variables.

class ansys.scadeone.core.swan.Variable#

Bases: SwanItem

Base class for Variable and ProtectedVariable.

get_full_path() str#

Full path of Swan construct.

static set_owner(owner: Self, children: Self | Iterable[Self])#

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

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem]]

Items to set owner.

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: Model#

Return model containing the Swan item.

property module: ModuleBase#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface

property owner: Self#

Owner of current Swan construct.

class ansys.scadeone.core.swan.VarDecl(id: Identifier, is_clock: bool | None = False, is_probe: bool | None = False, type: GroupTypeExpression | None = None, when: ClockExpr | None = None, default: Expression | None = None, last: Expression | None = None)#

Bases: Declaration, Variable

Class for variable declaration.

get_full_path() str#

Full path of Swan construct.

static set_owner(owner: Self, children: Self | Iterable[Self])#

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

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem]]

Items to set owner.

var_decl() str#

Return variable declaration string.

property default: Expression | None#

Variable default expression.

property id: Identifier#

Language item identifier.

property is_clock: bool#

True when variable is a clock.

property is_input: bool#

True when variable is an input.

property is_local: bool#

True when variable is local.

property is_output: bool#

True when variable is an output.

property is_probe: bool#

True when variable is a probe.

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 last: Expression | None#

Variable last expression.

property model: Model#

Return model containing the Swan item.

property module: ModuleBase#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface

property owner: Self#

Owner of current Swan construct.

property type: GroupTypeExpression | None#

Variable type.

property when: ClockExpr | None#

Variable clock.

class ansys.scadeone.core.swan.ProtectedVariable(data: str)#

Bases: Variable, ProtectedItem

Protected variable definition as a string.

get_full_path() str#

Full path of Swan construct.

has_markup(markup: str) bool#

Check if protected data has the specified markup.

Parameters:
markupstr

String markup.

Returns:
result: bool

True when instance markup is same as parameter.

static set_owner(owner: Self, children: Self | Iterable[Self])#

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

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem]]

Items to set owner.

property data: str#

Protected data between markups.

Returns:
str

Protected data.

property is_protected#

Tell if item is syntactically protected and provided as a string.

property markup: str#

Protection markup.

Returns:
str

Markup string.

property model: Model#

Return model containing the Swan item.

property module: ModuleBase#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface

property owner: Self#

Owner of current Swan construct.