2 Copyright (c) 2000-2014 Ericsson Telecom AB
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
11 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
12 <meta http-equiv=
"Content-Language" content=
"en-us">
13 <title>variant
</title>
15 <body bgcolor=
"#DAD3C5" vlink=
"#0094D2" link=
"#003258">
16 <table align=
"left" border=
"0" cellspacing=
"0" cellpadding=
"0" valign=top
>
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>
21 <table border=
"0" align=
"right" cellpadding=
"0" cellspacing=
"0">
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=
"var.html" alt=
"previous"><img border=
"0" src=
"../images/left.jpg" width=
"53" height=
"40"></a></td>
26 <td><a href=
"verdicttype.html" alt=
"next"><img border=
"0" src=
"../images/right.jpg" width=
"53" height=
"40"></a></td>
33 <hr align=
"left" width=
"75%">
34 <p>The attribute is used to refine the currently specified encoding scheme instead of its replacement.
35 <p>Currently, two encoding schemes are supported in TITAN: RAW and TEXT.
36 <p>The RAW coder encodes and decodes TTCN-
3 values to/from bitstreams. The TEXT coder can be utilized for text-based protocols.
37 <p>There are presently twenty-two arguments for the RAW coder specified as follows
39 <li>FIELDLENGTH specifies the length of the encoded type;
</li>
40 <li>COMP specifies how negative integer numbers are encoded ;
</li>
41 <li>ALIGN specifies whether the actual value will be padded from left or right;
</li>
42 <li>BITORDERINFIELD specifies whether the most or the less significant bit will be sent first on the port;
</li>
43 <li>BYTEORDER specifies whether the first or the last byte will be sent first on the port;
</li>
44 <li>BITORDER specifies the sequence of the bits within an octet;
</li>
45 <li>HEXORDER specifies the sequencer of the hexadecimal digits in the encoded data;
</li>
46 <li>FIELDORDER specifies how consecutive fields of a structured type is framed into octets;
</li>
47 <li>EXTENSION_BIT manipulates the bit used in some protocols to code data spanning several octets;
</li>
48 <li>EXTENSION_BIT_GROUP
limits the extension bit mechanism to a group of the fields in a record;
</li>
49 <li>PADDING
is used when the encoded type shall end at a multiple of padding units;
</li>
50 <li>PREPADDING is used when the encoded type shall start at a multiple of padding units;
</li>
51 <li>PADDING_PATTERN specifies padding pattern used by padding mechanism;
</li>
52 <li>PADDALL means that the padding parameter specified for a whole
record or set will be valid for every field of the record/set;
</li>
53 <li>LENGTHTO specifies which fields are considered when calculating the length parameter;
</li>
54 <li>LENGTHINDEX extends the LENGTHTO attribute;
</li>
55 <li>UNIT attribute is used in conjunction with the LENGTHTO or POINTERTO attribute;
</li>
56 <li>POINTERTO specifies to which field a pointer points;
</li>
57 <li>PTROFFSET specifies where the pointed field area starts and the base field of pointer calculating;
</li>
58 <li>TAG identifies specific values in certain fields of the set, record elements or union choices;
</li>
59 <li>CROSSTAG is used when one field of a record specifies the union member of an other field of a record;
</li>
60 <li>PRESENCE indicates the presence of an other optional field within records.
</li>
62 <p>The above arguments are described in detail in the Appendix B of the TITAN user documentation.
</p>
63 <p>Related keywords:
</p>
65 <li><a href=
"encode.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">encode
</font></b></a></li>
66 <li><a href=
"with.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">with
</font></b></a></li>
67 <li><a href=
"override.html"><b><font face=
"Courier New" color=
"#003258" size=
"4">override
</font></b></a></li>
69 <hr align=
"left" width=
"50%">
72 <table border=
"0" width=
"90%" bgcolor=
"#FFB599" cellpadding=
"4">
75 <h3 align=
"center"><font face=
"Courier New" color=
"#003258" size=
"5"><b>variant
</b></font> [
<font face=
"Courier New" color=
"#003258" size=
"5"><b>override
</b></font> ] [
<font
76 face=
"Courier New" color=
"#003258" size=
"5"><b>(
</b></font><i>qualifier
</i><font face=
"Courier New" color=
"#003258" size=
"5"><b>)
</b></font> ]
<font face=
"Courier New" color=
"#003258" size=
"5"><b>"</b></font><i>argument
</i><b><font
77 face=
"Courier New" color=
"#003258" size=
"5">"</font></b></h3>
85 <p>the optional
<b><font face=
"Courier New">override
</font></b> directive forces all contained types at all lower scopes to be forced to the specified attribute.
</p>
88 <p>the optional
<i>qualifier
</i> points out the entity for which the argument is valid.
</p>
91 <p><i>argument
</i> is a free-text string specifying the actual attribute.
</p>
93 <li>When using the variant attribute, it is very important to specify the desired codec in the with attributes of the module definition using the
<code>encode
</code> directive.
95 <hr align=
"left" width=
"50%">
97 <p><code> module m {
<br>
98 type integer INT2 with { variant
"COMP(
2scompl)
",
"FIELDLENGTH(
8)
" }
</font><br>
99 } with { encode
"RAW" }
</code>
100 <p>The encoding of the integer value -
1 results in the bit string
11111111.
</p>
101 <hr align=
"left" width=
"25%">
102 <hr align=
"left" width=
"25%">
103 <p><a HREF=
"BNF.html#attribkeyword">BNF definition
</a> of
<font face=
"Courier New"> variant
</font></p>