Debian Codegraph @

help/info/sizeof.html

raw symbols SCIP
1 <!--
2 Copyright (c) 2000-2021 Ericsson Telecom AB
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Eclipse Public License v2.0
5 which accompanies this distribution, and is available at
6 https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
7
8 Contributors:
9 Baji, Laszlo
10 Balasko, Jeno
11 Csorba, Mate
12 Forstner, Matyas
13 Kovacs, Ferenc
14 Szabados, Kristof
15 Szabo, Janos Zoltan – initial implementation
16 -->
17 <html>
18 <head>
19 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
20 <meta http-equiv="Content-Language" content="en-us">
21 <title>sizeof</title>
22 </head>
23 <body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258">
24 <table align="left" border="0" cellspacing="0" cellpadding="0" valign=top>
25 <tr>
26 <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>
27 </tr>
28 </table>
29 <table border="0" align="right" cellpadding="0" cellspacing="0">
30 <tr>
31 <td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td>
32 <td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td>
33 <td><a alt="previous" href="signature.html"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td>
34 <td><a alt="next" href="start.html"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td>
35 </tr>
36 </table>
37 <p><br clear="all">
38 </p>
39 <hr>
40 <h1>sizeof</h1>
41 <hr align="left" width="75%">
42 <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
43 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
44 arrays, the actual value to be returned is the sequential number of the last defined element (index of that element plus 1).
45 <hr align="left" width="50%">
46 <p>Related keyword:</p>
47 <ul>
48 <li><b><font face="Courier New" size="4" color="#003258"><a href="integer.html">integer</a></font></b></li>
49 <li><b><a href="record.html"><font face="Courier New" size="4" color="#003258">record</font></a></b></li>
50 <li><b><a href="set.html"><font face="Courier New" size="4" color="#003258">set</font></a></b></li>
51 <li><b><a href="template.html"><font face="Courier New" size="4" color="#003258">template</font></a></b></li>
52 </ul>
53 <hr align="left" width="50%">
54 <div align="center">
55 <center>
56 <table border="0" width="90%" bgcolor="#FFB599" cellpadding="4">
57 <tr>
58 <td width="100%">
59 <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
60 face="Courier New" color="#003258" size="5"><b>) return integer</b></font></h3>
61 </td>
62 </tr>
63 </table>
64 </center>
65 </div>
66 <ul>
67 <li>
68 <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>
69 </li>
70 </ul>
71 <hr align="left" width="25%">
72 <p>Example 1:</p>
73 <p><font face="Courier New"> &nbsp;&nbsp;type record MyPDU<br>
74 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;boolean field1 optional,<br>
75 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;integer field2<br>
76 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};<br>
77 &nbsp;&nbsp;type record of integer MyPDU1;<br>
78 <br>
79 &nbsp;&nbsp;const MyPDU MyConst :=<br>
80 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;field1 := true,<br>
81 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;field2 := 29<br>
82 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};<br>
83 <br>
84 &nbsp;&nbsp;template MyPDU MyTemplate :=<br>
85 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;field1 := omit,<br>
86 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;field2 := 5<br>
87 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};<br>
88 <br>
89 &nbsp;&nbsp;var integer numElements;<br>
90 <br>
91 <p>...
92 <p>&nbsp;&nbsp;numElements := sizeof(MyConst); // returns 2<br>
93 &nbsp;&nbsp;numElements := sizeof(MyTemplate); // returns 1<br>
94 </font></p>
95 <p>Example 2:</p>
96 <p><font face="Courier New"> &nbsp;&nbsp;type record of integer MyRecord;<br>
97 &nbsp;&nbsp;var MyRecord MyRecordVar;<br>
98 &nbsp;&nbsp;MyRecordVar := { 0, 1, -, 2 };<br>
99 <br>
100 <p>...
101 <p>&nbsp;&nbsp;numElements := sizeof(MyRecordVar);<br>
102 &nbsp;&nbsp;// returns 4 without respect to the fact, that the element MyRecordVar[2] is undefined
103 </font></p>
104 <hr align="left" width="25%">
105 </body>
106 </html>