Technical topic: OpenGEODE - SDL Operators: How to work with data

From TASTE
Revision as of 09:55, 7 February 2019 by Mperrotin (talk | contribs)
Jump to: navigation, search

Introduction

The SDL language primarily targets the description of a system's behaviour. It is however also possible to manipulate data using a collection of built-in operators. This can be convenient to avoid depending on external, manually-written code to process the parameters of messages during the execution of a state machine transition.

Variables are defined in the ASN.1 language and can express simple types (boolean, numbers and enumerated values) as well as complex data structures (records, arrays, and choices). Each type comes with some dedicated operators which are described in this page.


INTEGER types

``` MyInt ::= INTEGER (0 .. 255) ```


REAL types

``` MyReal ::= REAL (0.0 .. 10.0) ```

ENUMERATED types

``` MyEnum ::= ENUMERATED { foo, bar } ```


CHOICE types

``` MyChoice ::= CHOICE { foo BOOLEAN, bar INTEGER (0 .. 255) } ```

SEQUENCE OF types (arrays)

``` MySeqOf ::= SEQUENCE (SIZE (0..10)) OF BOOLEAN ```

SEQUENCE types (records)

``` MySeq ::= SEQUENCE {

  a BOOLEAN OPTIONAL,
  b INTEGER (0 .. 255)

} ```