Skip to content

class AConstant

Package: swiss.avm.up.core.generic.type.javamodel.AConstant

Direct Known Subclasses: Constant, ModelConstant


abstract class AConstant extends AValue, NamedResource, Comment

A named compile-time constant in a DatatypeLibrary, held via the library's constant relation. The concrete kind used in practice is Constant; AConstant is the abstract range.

Each constant has a type (a standard/IEC type) and an init value literal.

Naming convention is UPPER_SNAKE_CASE.

Use library constants for shared magic numbers (limits, timings, sizes) instead of hardcoding them in code snippets.

Properties

comment

TextLiteral[0..1]

A Literal that accepts multiple lines of text.

name

The name of this Resource.

StringLiteral[1..1]

type

StandardType[1..1]

Method Summary

constantToS7Xml

@VariableFunctions_S7Tia

Parameters:

Build
IntegerLiteral
IntegerLiteral

getComment

@FComments

getValue

@FAConstant

Returns value of a constant. In case of ModelConstant, calculation of effective value.

Return:

StringLiteral

getVariableName

@FVariableName

with " for platform s7Tia

Parameters:

PlatformType

indexOfConstants

@VariableFunctionSpace

returns the index of the current constant in the constant list

Parameters:

DatatypeLibrary

Return:

IntegerLiteral