Operator declaration#
Signature#
Operator interface declaration, found in module interface.
- class ansys.scadeone.core.swan.Signature(id: Identifier, has_inline: bool, is_node: bool, inputs: List[Variable], outputs: List[Variable], sizes: List[Identifier] | None = None, constraints: List[TypeConstraint] | None = None, specialization: PathIdentifier | None = None, pragmas: List[Pragma] | None = None)#
Bases:
Declaration
,ModuleItem
Operator signature, without a body.
Used in interfaces.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- property constraints: Generator[TypeConstraint, None, None]#
Return constraints as a generator.
- 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 module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- property sizes: Generator[Identifier, None, None]#
Return sizes as a generator.
- property specialization: PathIdentifier | None#
Return specialization path_id or None.
Operator#
Operator definition, found in module body.
- class ansys.scadeone.core.swan.Operator(id: Identifier, has_inline: bool, is_node: bool, inputs: List[Variable], outputs: List[Variable], body: Scope | Equation | None | Callable, sizes: List[Identifier] | None = None, constraints: List[TypeConstraint] | None = None, specialization: PathIdentifier | None = None, pragmas: List[Pragma] | None = None)#
Bases:
Signature
Operator definition, with a body.
Used in modules. The body may not bet yet defined.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- property constraints: Generator[TypeConstraint, None, None]#
Return constraints as a generator.
- 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 module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- property sizes: Generator[Identifier, None, None]#
Return sizes as a generator.
- property specialization: PathIdentifier | None#
Return specialization path_id or None.
Constraints#
Constraint that can be applied to generic types.
- class ansys.scadeone.core.swan.TypeConstraint(type_vars: List[VariableTypeExpression] | str, kind: NumericKind)#
Bases:
SwanItem
Type constraint for operator. A constraint is:
where_decl ::= where typevar {{ , typevar }} numeric_kind
The typevar list can be protected and represented with string.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- property kind: NumericKind#
Constraint numeric kind.
- property module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- property type_vars: List[VariableTypeExpression] | str#
Returns type variable names of constraints.
- Returns:
Union
[List
[VariableTypeExpression
],str
]Returns the list of type names, if not protected, or the constraint names as a string.
Scopes#
Scope contains scope sections which define variables, equations, diagrams and other sections.
- class ansys.scadeone.core.swan.Scope(sections: List[ScopeSection], pragmas: List[Pragma] | None = None)#
Bases:
SwanItem
,PragmaBase
Scope definition:
data_def ::= scopescope ::= { {{scope_section}} }- get_declaration(name: str)#
Returns the type, global, operator or variable declaration searching by namespace.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- 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 module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- property sections: List[ScopeSection]#
Scope sections.
- class ansys.scadeone.core.swan.ScopeSection#
Bases:
SwanItem
Base class for scopes.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- 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 module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- class ansys.scadeone.core.swan.ProtectedSection(data: str)#
Bases:
ScopeSection
,ProtectedItem
Protected section, meaning a syntactically incorrect section construct.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- classmethod to_str(section: str, items: List[Any], end: str | None = ';') str #
Print section name with its list of items, one per line, ended with sep string.
- property is_protected#
Tell if item is syntactically protected and provided as a string.
- property module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.