Titan Core Initial Contribution
[deliverable/titan.core.git] / help / info / anytype.html
1 <!--
2 Copyright (c) 2000-2014 Ericsson Telecom AB
3
4 All rights reserved. This program and the accompanying materials
5 are made available under the terms of the Eclipse Public License v1.0
6 which accompanies this distribution, and is available at
7 http://www.eclipse.org/legal/epl-v10.html
8 -->
9 <html>
10 <head>
11 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
12 <meta http-equiv="Content-Language" content="en-us">
13 <title>anytype</title>
14 </head>
15 <body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258">
16 <table align="left" border="0" cellspacing="0" cellpadding="0" valign=top>
17 <tr>
18 <td width=105 height=40><a href="https://projects.eclipse.org/projects/tools.titan"><img src="../images/titan_transparent.gif" border=0 width=105 height=40 align="left" alt="Titan"></a></td>
19 </tr>
20 </table>
21 <table border="0" align="right" cellpadding="0" cellspacing="0">
22 <tr>
23 <td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td>
24 <td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td>
25 <td><a href="any.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td>
26 <td><a href="bit2hex.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td>
27 </tr>
28 </table>
29 <p><br clear="all">
30 </p>
31 <hr>
32 <h1>anytype</h1>
33 <hr align="left" width="75%">
34 <p>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
35 imported external types.
36 <ul>
37 <li>The fieldnames of the anytype shall be uniquely identified by the corresponding type names using the &quot;dot&quot; notation.</li>
38 </ul>
39 <p>Related keywords:</p>
40 <ul>
41 <li><a href="union.html"><font face="Courier New" color="#003258" size="4"><b>union</b></font></a> &nbsp;</li>
42 </ul>
43 <hr align="left" width="50%">
44 <div align="center">
45 <center>
46 <table border="0" width="90%" bgcolor="#FFB599" cellpadding="4">
47 <tr>
48 <td width="100%">
49 <h3 align="center"><font face="Courier New" color="#003258" size="5"><b>anytype</b></font></h3>
50 </td>
51 </tr>
52 </table>
53 </center>
54 </div>
55 <p>&nbsp;</p>
56 <div align="center">
57 <center>
58 <table border="0" width="100%" bgcolor="#C9C2BB" cellpadding="4">
59 <tr>
60 <td width="100%">
61 <blockquote>
62 <p><u>TITAN specific restriction compared to the standard:</u></p>
63 </blockquote>
64 <ul>
65 <li>
66 <p>&nbsp;<font face="Courier New" size="4"><b>anytype</b></font> can only contain the simple types, the ones defined in the same module and the <b>address</b> type. Imported types are not
67 included.</p>
68 </li>
69 <li>
70 <p>&nbsp;The types included in the <font face="Courier New" size="4"><b>anytype</b></font> of a module have to be declared by the user, using extension attributes.</p>
71 </li>
72 </ul>
73 </td>
74 </tr>
75 </table>
76 </center>
77 </div>
78 <hr align="left" width="50%">
79 <p>Example 1:
80 <p><font face="Courier New">module example {<br>
81 type float MyFloat;<br>
82 type charstring MyString;<br>
83 type record MyRecord {<br>
84 &nbsp;&nbsp;&nbsp;integer i,<br>
85 &nbsp;&nbsp;&nbsp;float f<br>
86 }<br>
87 ...</font>
88 <p><font face="Courier New">control {<br>
89 &nbsp;&nbsp;&nbsp;var anytype v_any;<br>
90 &nbsp;&nbsp;&nbsp;v_any.integer := 3;<br>
91 &nbsp;&nbsp;&nbsp;v_any.charstring := "hello";<br>
92 &nbsp;&nbsp;&nbsp;v_any.MyRecord := { i := 42, f := 0.5};<br>
93 ...<br>
94 &nbsp;&nbsp;&nbsp;v_any.integer := v_any.MyRecord.i - 2;<br>
95 }<br>
96 }<br>
97 with {<br>
98 extension "anytype integer, charstring, MyRecord" }<br>
99 </font>
100 <p><font face="Courier New" size="4"><b>anytype</b></font> is defined to contain 3 types: integer, charstring and the MyRecord type.<br>
101 The type MyFloat will not be a part of the anytype.<br>
102 3 is assigned to the integer part of v_any making it hold an integer value.<br>
103 "hello" is assigned to the charstring part of v_any making it hold a charstring value.<br>
104 A record is assigned to the MyRecord part of v_any making it hold a MyRecord value.<br>
105 The MyRecord contents of v_any is read and after decreasing it with 2 it is assigned to the integer part of v_any.<br>
106 <hr align="left" width="25%">
107 <hr align="left" width="25%">
108 <p><a HREF="BNF.html#anytypekeyword">BNF definition</a> of <font face="Courier New">anytype</font></p>
109 </body>
110 </html>
This page took 0.0339 seconds and 5 git commands to generate.