Defining a Data Dictionary
AF3 supports the definition of data types (e.g. enumerations) and functions by using the data-dictionary.
If your project has no Data Dictionary yet, please add it in the context menu of your project.
You can add Elements to your Data Dictionary by dragging them from the Model Elements View into your Data Dictionary.
Enumerations have Enumeration Members (numbers are assigned to the members automatically).
Functions have a defined return type and a definition, what to return (see next figure for an example).
You can also add Parameters to your Functions.
You can Copy&Paste existing functions or enumerations by opening the context menu of the respective function/enumeration, click "Copy",
and afterwards open the context menu of the root Data-Dictionary-Package (in the Data-Dictionary-View or in the Model-Navigator-View) and select "Paste".
Also the Undo/Redo functionality is available in these context-menus.
If you want to check your defined functions, AutoFOCUS provides an Evaluator for the Data Dictionary.
Simply click onto the Evaluator-Tab and insert commands into the lower field. The upper field shows the results of your inputs.
As you can see in the following Example, the Function "tRed()" returns 5 as defined.
Enumeration-Members can be accessed by adding a "()" behind their names.
Array-Elements can be accessed by the expression "array_variable[index]". The index starts from 0.
- READ Example: xyz = array[i]
- WRITE Example 1: array[i] = xyz
- WRITE Example 2: array = [xyz, yzx, ...]
Structure-Members can be accessed by the expression "structure_variabe.MEMBER_NAME".
- READ Example: xyz = structure_variable.MEMBER_NAME_X
- WRITE Example: structure_variable = {MEMBER_NAME_X: xxx, MEMBER_NAME_Y:yyy, ...}
Please keep this in mind because you will need this in Guards and Actions of State Automatons.