Commit | Line | Data |
---|---|---|
970ed795 EL |
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>sizeof</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 alt="previous" href="signature.html"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td> | |
26 | <td><a alt="next" href="start.html"><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>sizeof</h1> | |
33 | <hr align="left" width="75%"> | |
34 | <p>This function returns the declared number of elements of a <b><font face="Courier New">record, record of, set, set of</font></b> type or the actual number of elements of a constant, variable, <b><font | |
35 | face="Courier New">template</font></b> of these types or array. In the case of <b><font face="Courier New">record of</font></b> and <b><font face="Courier New">set of</font></b> values or templates or | |
36 | arrays, the actual value to be returned is the sequential number of the last defined element (index of that element plus 1). | |
37 | <hr align="left" width="50%"> | |
38 | <p>Related keyword:</p> | |
39 | <ul> | |
40 | <li><b><font face="Courier New" size="4" color="#003258"><a href="integer.html">integer</a></font></b></li> | |
41 | <li><b><a href="record.html"><font face="Courier New" size="4" color="#003258">record</font></a></b></li> | |
42 | <li><b><a href="set.html"><font face="Courier New" size="4" color="#003258">set</font></a></b></li> | |
43 | <li><b><a href="template.html"><font face="Courier New" size="4" color="#003258">template</font></a></b></li> | |
44 | </ul> | |
45 | <hr align="left" width="50%"> | |
46 | <div align="center"> | |
47 | <center> | |
48 | <table border="0" width="90%" bgcolor="#FFB599" cellpadding="4"> | |
49 | <tr> | |
50 | <td width="100%"> | |
51 | <h3 align="center"><font face="Courier New" color="#003258" size="5"><b>sizeof</b></font><font face="Courier New" color="#003258" size="5"><b>(</b></font><i>structured_type value</i><font | |
52 | face="Courier New" color="#003258" size="5"><b>) return integer</b></font></h3> | |
53 | </td> | |
54 | </tr> | |
55 | </table> | |
56 | </center> | |
57 | </div> | |
58 | <ul> | |
59 | <li> | |
60 | <p>Only elements of the TTCN-3 object, which is the parameter of the function are calculated; i.e. no elements of nested types/values are taken into account at determining the return value.</p> | |
61 | </li> | |
62 | </ul> | |
63 | <hr align="left" width="25%"> | |
64 | <p>Example 1:</p> | |
65 | <p><font face="Courier New"> type record MyPDU<br> | |
66 | { boolean field1 optional,<br> | |
67 | integer field2<br> | |
68 | };<br> | |
69 | type record of integer MyPDU1;<br> | |
70 | <br> | |
71 | const MyPDU MyConst :=<br> | |
72 | { field1 := true,<br> | |
73 | field2 := 29<br> | |
74 | };<br> | |
75 | <br> | |
76 | template MyPDU MyTemplate :=<br> | |
77 | { field1 := omit,<br> | |
78 | field2 := 5<br> | |
79 | };<br> | |
80 | <br> | |
81 | var integer numElements;<br> | |
82 | <br> | |
83 | <p>... | |
84 | <p> numElements := sizeof(MyConst); // returns 2<br> | |
85 | numElements := sizeof(MyTemplate); // returns 1<br> | |
86 | </font></p> | |
87 | <p>Example 2:</p> | |
88 | <p><font face="Courier New"> type record of integer MyRecord;<br> | |
89 | var MyRecord MyRecordVar;<br> | |
90 | MyRecordVar := { 0, 1, -, 2 };<br> | |
91 | <br> | |
92 | <p>... | |
93 | <p> numElements := sizeof(MyRecordVar);<br> | |
94 | // returns 4 without respect to the fact, that the element MyRecordVar[2] is undefined | |
95 | </font></p> | |
96 | <hr align="left" width="25%"> | |
97 | </body> | |
98 | </html> |