# anytype

This special type is defined as a shorthand for the union of all known types in a TTCN-3 module. Known types include the following: built-in types, user-defined types, imported ASN.1 and other imported external types.

- The fieldnames of the anytype shall be uniquely identified by the corresponding type names using the "dot" notation.

Related keywords:

- union

### anytype

TITAN specific restriction compared to the standard: anytype can only contain the simple types, the ones defined in the same module and the address type. Imported types are not included. The types included in the anytype of a module have to be declared by the user, using extension attributes.

Example 1:

module example {
type float MyFloat;
type charstring MyString;
type record MyRecord {
integer i,
float f
}
...

control {
var anytype v_any;
v_any.integer := 3;
v_any.charstring := "hello";
v_any.MyRecord := { i := 42, f := 0.5};
...
v_any.integer := v_any.MyRecord.i - 2;
}
}
with {
extension "anytype integer, charstring, MyRecord" }

anytype is defined to contain 3 types: integer, charstring and the MyRecord type.
The type MyFloat will not be a part of the anytype.
3 is assigned to the integer part of v_any making it hold an integer value.
"hello" is assigned to the charstring part of v_any making it hold a charstring value.
A record is assigned to the MyRecord part of v_any making it hold a MyRecord value.
The MyRecord contents of v_any is read and after decreasing it with 2 it is assigned to the integer part of v_any.

BNF definition of anytype