Difference between revisions of "Core.Declarations.GlobalDeclarations"

From emotive
Jump to navigation Jump to search
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:OTX '''Global Declarations''' data model}}[[Category:OTX-Core]][[Category:Declarations]]
+
{{DISPLAYTITLE:OTX '''Global Declarations'''}}[[Category:OTX-Core]][[Category:Declarations]]
 
== Classification ==
 
== Classification ==
{{ClassificationCore | Global Declarations | OTX global declarations data model | [[OtxReference#Core|OTX Core]] | - }}
+
{{ClassificationCore | Global Declarations | Global variables and constants | [[OtxReference#Core|OTX Core]] | - }}
  
 
== Introduction ==
 
== Introduction ==
In the global declaration block:
+
The following elments can be declared in the global declaration block:
  
* Global Constant
+
* Global Constants
* Document Variable
+
* Context Variables
* Context Variable
+
* State Variables
 +
* Document Variables
  
can be declared. These elements have a global validity. That is, they can both within the document in which they are declared, as well as in other documents, see [[OtxImports|Imports]] are used.
+
These elements have a global scope. That is, they can be used anywhere within the document in which they are declared, as well as in other documents, see [[Core.Imports|Imports]]. One global declaration of a document can not have the same with another global declaration of the same document.
  
 
== Semantics ==
 
== Semantics ==
 
=== Global Constant ===
 
=== Global Constant ===
The value of a global constant is set at design time and can not be changed at runtime. For global constants have the following [[OtxVisibilities|Visibilities]]:
+
The value of a global constant is set at design-time and can not be changed at runtime. The global constants must have one of the following [[Core.Visibilities|Visibilities]]:
  
 
* Private (default)  
 
* Private (default)  
Line 20: Line 21:
 
* Public
 
* Public
  
A constant has a [[OtxDataTypes|Type]] and a corresponding type value.
+
A constant has a [[Core.DataTypes|Type]] and it must have a initial value corresponding to the type. As a result, they can not has [[Core.DataTypes|Type]] which does not has an explicit value.
  
=== Document Variable ===
+
=== Context Variable ===
The value of a global variable can be changed at runtime. Global variables can only be used in the same document. They have, therefore only the following [[OtxVisibilities|Visibilities]]:
+
Context variables are environment variables which behave like global constants. However, they have a special meaning. They represent environment-related data, such as vehicle type, name of workshop, user login name, etc., see the [[General.Principles#ContextConcept|Context Concept]]. Context variables are the counter part of state variables. They are mechanism to transport environment information to the sequence. The context variables must have one of the following [[Core.Visibilities|Visibilities]]:
  
* Private (fix)
+
* Private (default)
 +
* Package
 +
* Public
  
A variable has a [[OtxDataTypes|Type]] and a corresponding type the initial value (default value).
+
A context variable has a [[Core.DataTypes|Type]] and it may have an initial value corresponding to the type.
  
=== Context Variable ===
+
=== State Variable ===
Context variables behave like global constants. However, they have a special meaning. They represent environment-related data, such as vehicle type, name of workshop, Logged in User, etc., see the [[OtxPrinciples#ContextConcept|Context Concept]]. Context variables have one of the following visibilities:
+
State variables are environment variables which behave like global variables. However, state variables can only be set and cannot read inside OTX, the test logic shall not be based on the value of a State variable. State variables are the counter part of context variables. They are mechanism to transport status information from inside a sequence to the environment. The state variables must have one of the following [[Core.Visibilities|Visibilities]]:
  
 
* Private (default)
 
* Private (default)
Line 36: Line 39:
 
* Public
 
* Public
  
A context variable has a [[OtxDataTypes|Type]] and a corresponding type the default value.
+
A state variable has a [[Core.DataTypes|Type]] and it may have a initial value corresponding to the type.
 +
 
 +
=== Global Variable (Document Variable) ===
 +
The value of a global variable can be changed at runtime. Global variables can only be used in the same document. Therefore, they only have one following [[Core.Visibilities|Visibility]]:
 +
 
 +
* Private (fixed)
 +
 
 +
A variable has a [[Core.DataTypes|Type]] and it may have a initial value corresponding to the type.
  
 
== Checker rules ==
 
== Checker rules ==
 
{| {{TableHeader}}
 
{| {{TableHeader}}
{{TableRowKeyValueList|[[CoreChk051|Core_Chk051]]|Immutability of constants, input parameters and context variables}}
+
{{TableRowKeyValueList|[[Core.Validation.CoreChk009|Core_Chk009]]|Mandatory constant initialisation}}
{{TableRowKeyValueList|[[CoreChk004|Core_Chk009]]|Mandatory constant initialisation}}
+
{{TableRowKeyValueList|[[Core.Validation.CoreChk051|Core_Chk051]]|Immutability of constants, input parameters and context variables}}
 +
{{TableRowKeyValueList|[[Core.Validation.CoreChk052|Core_Chk052]]|Identifier shadowing }}
 +
{{TableRowKeyValueList|[[Extensions.StateVariable.StatVarChk001|StatVar_Chk001]]|State variables shall not read }}
 
|}
 
|}
  
 
== See also ==
 
== See also ==
[[OtxValidation|Validation (OTX-Checker)]] <br/>
+
[[Core.Validation|Validation (OTX-Checker)]] <br/>
​​[[OtxNamingConventions|Naming Conventions]] <br/>
+
​​[[General.NamingConventions|Naming Conventions]] <br/>
[[OtxDeclarations|Imports]] <br/>
+
[[Core.Imports|Imports]] <br/>
[[OtxVisibilities|Visibilities]] <br/>
+
[[Core.Visibilities|Visibilities]] <br/>
[[OtxValidities|Validities]] <br/>
+
[[Core.Validities|Validities]] <br/>
[[OtxSignatures|Signatures]] <br/>
+
[[Core.Signatures|Signatures]] <br/>
[[OtxParameters|Parameter Declarations]] <br/>
+
[[Core.Parameters|Parameter Declarations]] <br/>
[[OtxProcedures|Procedures]] <br/>
+
[[Core.Procedures|Procedures]] <br/>
[[OtxComments|Comments]]
+
[[Core.Comments|Comments]]

Latest revision as of 08:34, 30 August 2018

Classification

Name Global Declarations
Short Description Global variables and constants
Class OTX Core
Pre-Conditions -
Specified by ISO 13209-2

Introduction

The following elments can be declared in the global declaration block:

  • Global Constants
  • Context Variables
  • State Variables
  • Document Variables

These elements have a global scope. That is, they can be used anywhere within the document in which they are declared, as well as in other documents, see Imports. One global declaration of a document can not have the same with another global declaration of the same document.

Semantics

Global Constant

The value of a global constant is set at design-time and can not be changed at runtime. The global constants must have one of the following Visibilities:

  • Private (default)
  • Package
  • Public

A constant has a Type and it must have a initial value corresponding to the type. As a result, they can not has Type which does not has an explicit value.

Context Variable

Context variables are environment variables which behave like global constants. However, they have a special meaning. They represent environment-related data, such as vehicle type, name of workshop, user login name, etc., see the Context Concept. Context variables are the counter part of state variables. They are mechanism to transport environment information to the sequence. The context variables must have one of the following Visibilities:

  • Private (default)
  • Package
  • Public

A context variable has a Type and it may have an initial value corresponding to the type.

State Variable

State variables are environment variables which behave like global variables. However, state variables can only be set and cannot read inside OTX, the test logic shall not be based on the value of a State variable. State variables are the counter part of context variables. They are mechanism to transport status information from inside a sequence to the environment. The state variables must have one of the following Visibilities:

  • Private (default)
  • Package
  • Public

A state variable has a Type and it may have a initial value corresponding to the type.

Global Variable (Document Variable)

The value of a global variable can be changed at runtime. Global variables can only be used in the same document. Therefore, they only have one following Visibility:

  • Private (fixed)

A variable has a Type and it may have a initial value corresponding to the type.

Checker rules

Core_Chk009 Mandatory constant initialisation
Core_Chk051 Immutability of constants, input parameters and context variables
Core_Chk052 Identifier shadowing
StatVar_Chk001 State variables shall not read

See also

Validation (OTX-Checker)
​​Naming Conventions
Imports
Visibilities
Validities
Signatures
Parameter Declarations
Procedures
Comments