OTX Reference  
OpenTestSystem.Otx.Core.Actions.ProcedureCall Class Reference

Calling a Procedure More...

Inheritance diagram for OpenTestSystem.Otx.Core.Actions.ProcedureCall:
Inheritance graph

Classes

class  Arguments
 Represents the list of arguments for a procedure call. More...
 

Public Attributes

Arguments arguments
 Represents the list of arguments for a procedure call. More...
 
OtxLink procedure
 Calling procedure or signature. More...
 
System.Boolean throwExceptionOnAmbiguousCall
 If throwExceptionOnAmbiguousCall is true and two or more of the implementing procedures are valid, the AmbiguousCallException will thrown. More...
 
- Public Attributes inherited from OpenTestSystem.Otx.Core.Actions.ActionRealisation
OtxLink validFor
 Validity of ActionRealisation. More...
 

Detailed Description

Calling a Procedure

This action calls another OTX procedure (directly or indirectly via a signature). If there are input parameters declared by the callee, the ProcedureCall action allows describing a list of corresponding arguments which will be passed to the callee at runtime. OTX procedures do not have one single dedicated return value – instead, they can define a set of output parameters which can (but do not have to) be used by the caller. Procedure calls can happen in-document or cross-document; the latter means that a procedure defined in one document can call another signature or procedure defined in another, separate document. In the latter case, the visibility information of the called signature or procedure has to be taken into account. Procedures or signatures which are not visible to the caller are not callable.

Note
ProcedureCall represents an exemption concerning the atomicity of Action nodes. It is not atomic. If a ProcedureCall is executed in a Parallel lane and a TerminateLanes node is executed in another lane, procedure execution shall be completed prematurely. The same rules as for prematurely completed lanes apply.

The OTX procedure call is closely linked to the signature concept. Therefore, the runtime semantics differ depending if a procedure was directly called or if there's an indirection via a signature, see picture.

  • In the direct case, the called procedure will be executed after input argument evaluation and passing, if it is valid with respect to the context. If the procedure is not valid, nothing is executed (NOP).
  • In the indirect case (the call target is a signature) a procedure implementing the signature needs to be identified. Since this is a dynamic process (the linking is done at runtime, not at authoring time), the OTX runtime have a signature-to-procedure-mapping: For a given signature name, the mapping contains a list of all procedures implementing that signature. When a signature is called, the runtime infers the procedure from the mapping. The runtime will only identify procedures which are visible to the document defining the signature and which are valid with respect to the context, see validities concept. If there is more than one applicable procedure available for the signature and the attribute throwExceptionOnAmbiguousCall is true an exception will be thrown. Otherwise the first applicable procedure (in ascending alphabetic order) will be executed. The ordering will be done after package-, document- and procedure-name. If there is no implementing procedure, nothing will be executed; nonetheless, inout- and out-arguments will be set to init-values of the corresponding parameters, if init-values are provided in the signature. Otherwise, inout- and out-arguments stay unchanged.

Syntax
[ThrowExceptionOnAmbiguousCall, Boolean value]
ProcedureName(Argument1, out Argument2, ref Argument3, ..., ArgumentN) [validFor Validity];
OtxLink validFor
Validity of ActionRealisation.
Definition: Core.cs:5929
Example
namespace ProcedureCallSamplePackage1
{
private validity IsDebug = Debugger;
private validity IsNormal = !Debugger;
package ProcedureSignature HandleMessage(in String Message);
private contextVariable Boolean Debugger = true;
public procedure main()
{
DisplayMessage("Hello World");
[ThrowExceptionOnAmbiguousCall, false]
HandleMessage("Hello World");
}
public procedure DisplayMessage(in String Message) implements HandleMessage validFor IsNormal
{
HMI.ConfirmDialog(Message);
}
private procedure WriteDebugMessage(in String Message) implements HandleMessage validFor IsDebug
{
Logging.WriteLog(@SeverityLevel:INFO, NULL, Message);
}
}
OtxLink procedure
Calling procedure or signature.
Definition: Core.cs:7106
Checker rules
CheckerRule.Core_Chk030 - Input- and in/output-argument omission
Exceptions
Exceptions.InvalidReferenceExceptionIf one of the inout-arguments is invalid (e.g. an uninitialized variable).
Exceptions.AmbiguousCallExceptionIn case of indirect call via signature and throwExceptionOnAmbiguousCall=true: if two or more implementing procedures are valid at the same time (call target cannot be determined unambiguously).
See also
Core.Procedure, Core.Signatures.ProcedureSignature, Core.Visibility

Member Data Documentation

◆ arguments

Arguments OpenTestSystem.Otx.Core.Actions.ProcedureCall.arguments

Represents the list of arguments for a procedure call.

Checker rules
CheckerRule.Core_Chk029 - Correct ProcedureCall arguments

◆ procedure

OtxLink OpenTestSystem.Otx.Core.Actions.ProcedureCall.procedure

Calling procedure or signature.

Contains the fully qualified name of the called procedure or signature. For cross-document calls, a prefix is needed which indicates the external document. The prefix shall be defined by a corresponding import element in the imports section of the OTX document. For in-document calls, no prefix is needed.

Note
The target of a ProcedureCall must be visible to the caller. The information given by the visibility attribute of the called signature or procedure is to be taken into account.
If the target of a ProcedureCall is a procedure or signature without realisation, the call is NOP. The same applies for the call of a procedure which is not valid with respect to the context. Given arguments of the ProcedureCall action will stay unchanged.
Checker rules
CheckerRule.Core_Chk053 - no dangling OtxLink associations
CheckerRule.Core_Chk028 - No Operation (NOP) ProcedureCall
CheckerRule.Core_Chk024 - correct target for ProcedureCall
CheckerRule.Core_Chk025 - procedure signature has at least one implementing procedure
CheckerRule.Core_Chk017 - checked exceptions (1)
CheckerRule.Core_Chk018 - checked exceptions (2)

◆ throwExceptionOnAmbiguousCall

System.Boolean OpenTestSystem.Otx.Core.Actions.ProcedureCall.throwExceptionOnAmbiguousCall

If throwExceptionOnAmbiguousCall is true and two or more of the implementing procedures are valid, the AmbiguousCallException will thrown.