Sync with 5.4.0
[deliverable/titan.core.git] / help / info / trigger.html
1 <!--
2 Copyright (c) 2000-2015 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>trigger</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="to.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td>
26 <td><a href="true.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>trigger</h1>
33 <hr align="left" width="75%">
34 <p>The asynchronous operation belongs to the family of message-based communication operations. It is used to receive a value from an incoming message port queue. When the first message in the
35 queue matches the criteria described in the value part, the operation works exactly as described under the keyword&nbsp; <a href="receive.html"><b><font face="Courier New"
36 color="#003258" size="4">receive</font></b></a>, otherwise the message is discarded.
37 <ul>
38 <li>The operation can be used on connected ports only.</li>
39 <li>The operation has blocking semantics (except when used within an alt statement!) i.e., the TTCN3 program execution is halted until a message arrives.</li>
40 <li>The operation examines the 1st message on the port queue, extracts this and discards the message unless it matches the receiving template</li>
41 <li>In case of multiple connections the operation may be restricted to a certain sender.</li>
42 <li>The received value and the address of the sender may be stored.</li>
43 </ul>
44 <p>Related keywords:</p>
45 <ul>
46 <li><a href="address.html"><b><font face="Courier New" color="#003258" size="4">address</font></b></a></li>
47 <li><a href="any.html"><b><font face="Courier New" color="#003258" size="4">any</font></b></a></li>
48 <li><a href="create.html"><b><font face="Courier New" color="#003258" size="4">create</font></b></a></li>
49 <li><a href="from.html"><b><font face="Courier New" color="#003258" size="4">from</font></b></a></li>
50 <li><a href="modifies.html"><b><font face="Courier New" color="#003258" size="4">modifies</font></b></a></li>
51 <li><a href="receive.html"><b><font face="Courier New" color="#003258" size="4">receive</font></b></a></li>
52 <li><a href="sender.html"><b><font face="Courier New" color="#003258" size="4">sender</font></b></a></li>
53 <li><a href="system.html"><b><font face="Courier New" color="#003258" size="4">system</font></b></a></li>
54 <li><a href="value.html"><b><font face="Courier New" color="#003258" size="4">value</font></b></a></li>
55 </ul>
56 <hr align="left" width="50%">
57 <div align="center">
58 <center>
59 <table border="0" width="90%" bgcolor="#FFB599" cellpadding="4">
60 <tr>
61 <td width="100%">
62 <h3 align="center"><i>port_reference</i><font face="Courier New" color="#003258" size="5"><b>.trigger </b></font>[ <font face="Courier New" color="#003258" size="5"><b> (</b></font><i>
63 value_part </i><font face="Courier New" color="#003258" size="5"><b>)</b></font> ] [ <font face="Courier New" color="#003258" size="5"><b>from </b></font><i>address_reference</i> ] [ <font
64 face="Courier New" color="#003258" size="5"><b>-&gt; </b></font><i>assignment_part</i> ]<font face="Courier New" color="#003258" size="5"><b>;</b></font> &nbsp;</h3>
65 </td>
66 </tr>
67 </table>
68 </center>
69 </div>
70 <ul>
71 <li>
72 <p><i> port_reference</i> points out the incoming message port.</p>
73 </li>
74 <ul>
75 <li>
76 <p>the keywords <b><font face="Courier New" color="#003258" size="4">any port</font> </b> may be used to indicate that messages from any port will be accepted (see the <a href="#Example 7:">example
77 7</a>).</p>
78 </li>
79 </ul>
80 <li>
81 <p>The <b><font face="Courier New" color="#003258" size="4">trigger</font> </b>keyword introduces the message reception.</p>
82 </li>
83 <li>
84 <p><i>value_part</i> is one of the following: (rem.: when omitted, <a href="#Example 4"> any message will be accepted</a>)</p>
85 <ul>
86 <li>a literal value, a constant, a variable, an expression. (see the <a href="#Example 1">example1</a>)</li>
87 <li>a value template (see the <a href="#Example 2">example 2</a>)</li>
88 <li>a modified template (see the <a href="#Example 3">example 3</a>)<br>
89 &nbsp;</li>
90 </ul>
91 </li>
92 <table border="0" width="100%" bgcolor="#C9C2BB" cellpadding="4">
93 <tr>
94 <td width="100%">
95 <p><u>TITAN specific restriction compared to the standard:</u></p>
96 <ul>
97 <li>
98 <p>&nbsp;modified template is not implemented. When encountered in the TTCN-3 program, an error message will be generated.</p>
99 </li>
100 </ul>
101 </td>
102 </tr>
103 </table>
104 <li>
105 <p>The optional <b><font face="Courier New" color="#003258" size="4">from</font> </b> keyword is used when a port is connected to several entities and restriction to one communication partner is
106 required.</p>
107 </li>
108 </ul>
109 <ul>
110 <li>
111 <p><i>address_reference</i> is one of the following:</p>
112 <ul>
113 <li>a component reference (cf. <a href="create.html"><b><font face="Courier New" color="#003258" size="4">create</font></b></a>)&nbsp; or the keyword <a href="system.html"
114 target="_blank"><b><font face="Courier New" color="#003258" size="4">system</font></b></a>, in case of one-to-many connections.</li>
115 <li>
116 <p>an address reference (cf. <a href="address.html"><b><font face="Courier New" color="#003258" size="4">address</font></b></a>) , when there are several entities within the
117 system under test .</p>
118 </li>
119 </ul>
120 </li>
121 <li>
122 <p><i>assignment_part</i> is one or both of the following:</p>
123 <ul>
124 <li>the <a href="sender.html"><b><font face="Courier New" color="#003258" size="4">sender</font></b></a> keyword followed by a variable of <a href="address.html"
125 target="_blank"><b><font face="Courier New" color="#003258" size="4">address</font></b></a> or&nbsp; <a href="component.html"><b><font face="Courier New" color="#003258"
126 size="4">component</font></b></a> type to store the address of the sender (see the <a href="#Example 5">example 5</a>).</li>
127 <li>the <a href="value.html"><b><font face="Courier New" color="#003258" size="4">value</font></b></a> keyword followed by a variable of the same type as the received message
128 to store the received value (see the <a href="#Example 6:">example 6</a>).</li>
129 </ul>
130 </li>
131 </ul>
132 <hr align="left" width="50%">
133 <p><a name="Example 1">Example 1</a>: literal value
134 <p><font face="Courier New">portibus_PCO.trigger (charstring:&quot;abl&quot;) from system;</font>
135 <p>The character string abl is accepted over the port portibus_PCO from the test system interface. The port is connected to several components.</p>
136 <hr align="left" width="50%">
137 <p><a name="Example 2">Example 2</a>: template</p>
138 <p><font face="Courier New">portibus_PCO.trigger (tr_MeiTemplate));</font></p>
139 <p>The template (tr_MeiTemplate) determines what kind of messages will be accepted.</p>
140 <hr align="left" width="50%">
141 <p><a name="Example 3">Example 3</a>: modified template</p>
142 <p><font face="Courier New">portibus_PCO.trigger (modifies tr_MeiTemplate := {field1 := false});</font></p>
143 <p>The modified template (tr_MeiTemplate) determines what kind of messages will be accepted.</p>
144 <hr align="left" width="50%">
145 <p><a name="Example 4">Example 4</a>: any message reception</p>
146 <p><font face="Courier New">portibus_PCO.trigger;</font></p>
147 <p>Any message on port portibus_PCO will be accepted.</p>
148 <hr align="left" width="50%">
149 <p><a name="Example 5">Example 5</a>: storing the sender address</p>
150 <p><font face="Courier New">portibus_PCO.trigger (tr_MeiTemplate)) -&gt; sender v_address;</font></p>
151 <p>The address of the sender is stored in the variable v_address.</p>
152 <hr align="left" width="50%">
153 <p><a name="Example 6:">Example 6:</a> storing the received value</p>
154 <p><font face="Courier New">portibus_PCO.trigger (tr_MeiTemplate)) -&gt; value v_ReceivedMessage;</font></p>
155 <p>The received message is saved in the variable v_ReceivedMessage.</p>
156 <hr align="left" width="50%">
157 <p><a name="Example 7:">Example 7:</a> receive on any port</p>
158 <p><font face="Courier New">any port.trigger (tr_MeiTemplate)) -&gt; value v_ReceivedMessage;</font></p>
159 <p>The message matching the template tr_MeiTemplate and received on any port is saved to the variable v_ReceivedMessage.</p>
160 <hr align="left" width="25%">
161 <hr align="left" width="25%">
162 <p><a HREF="BNF.html#triggerstatement">BNF definition</a> of <font face="Courier New"> trigger</font></p>
163 </body>
164 </html>
This page took 0.048506 seconds and 5 git commands to generate.