| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
on |
| 14 |
|
| 15 |
<html> |
| 16 |
<head> |
| 17 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 18 |
<meta http-equiv="Content-Language" content="en-us"> |
| 19 |
<title>trigger</title> |
| 20 |
</head> |
| 21 |
<body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258"> |
| 22 |
<table align="left" border="0" cellspacing="0" cellpadding="0" valign=top> |
| 23 |
<tr> |
| 24 |
<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> |
| 25 |
</tr> |
| 26 |
</table> |
| 27 |
<table border="0" align="right" cellpadding="0" cellspacing="0"> |
| 28 |
<tr> |
| 29 |
<td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td> |
| 30 |
<td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td> |
| 31 |
<td><a href="to.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td> |
| 32 |
<td><a href="true.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td> |
| 33 |
</tr> |
| 34 |
</table> |
| 35 |
<p><br clear="all"> |
| 36 |
</p> |
| 37 |
<hr> |
| 38 |
<h1>trigger</h1> |
| 39 |
<hr align="left" width="75%"> |
| 40 |
<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 |
| 41 |
queue matches the criteria described in the value part, the operation works exactly as described under the keyword <a href="receive.html"><b><font face="Courier New" |
| 42 |
color="#003258" size="4">receive</font></b></a>, otherwise the message is discarded. |
| 43 |
<ul> |
| 44 |
<li>The operation can be used on connected ports only.</li> |
| 45 |
<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> |
| 46 |
<li>The operation examines the 1st message on the port queue, extracts this and discards the message unless it matches the receiving template</li> |
| 47 |
<li>In case of multiple connections the operation may be restricted to a certain sender.</li> |
| 48 |
<li>The received value and the address of the sender may be stored.</li> |
| 49 |
</ul> |
| 50 |
<p>Related keywords:</p> |
| 51 |
<ul> |
| 52 |
<li><a href="address.html"><b><font face="Courier New" color="#003258" size="4">address</font></b></a></li> |
| 53 |
<li><a href="any.html"><b><font face="Courier New" color="#003258" size="4">any</font></b></a></li> |
| 54 |
<li><a href="create.html"><b><font face="Courier New" color="#003258" size="4">create</font></b></a></li> |
| 55 |
<li><a href="from.html"><b><font face="Courier New" color="#003258" size="4">from</font></b></a></li> |
| 56 |
<li><a href="modifies.html"><b><font face="Courier New" color="#003258" size="4">modifies</font></b></a></li> |
| 57 |
<li><a href="receive.html"><b><font face="Courier New" color="#003258" size="4">receive</font></b></a></li> |
| 58 |
<li><a href="sender.html"><b><font face="Courier New" color="#003258" size="4">sender</font></b></a></li> |
| 59 |
<li><a href="system.html"><b><font face="Courier New" color="#003258" size="4">system</font></b></a></li> |
| 60 |
<li><a href="value.html"><b><font face="Courier New" color="#003258" size="4">value</font></b></a></li> |
| 61 |
</ul> |
| 62 |
<hr align="left" width="50%"> |
| 63 |
<div align="center"> |
| 64 |
<center> |
| 65 |
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4"> |
| 66 |
<tr> |
| 67 |
<td width="100%"> |
| 68 |
<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> |
| 69 |
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 |
| 70 |
face="Courier New" color="#003258" size="5"><b>-> </b></font><i>assignment_part</i> ]<font face="Courier New" color="#003258" size="5"><b>;</b></font> </h3> |
| 71 |
</td> |
| 72 |
</tr> |
| 73 |
</table> |
| 74 |
</center> |
| 75 |
</div> |
| 76 |
<ul> |
| 77 |
<li> |
| 78 |
<p><i> port_reference</i> points out the incoming message port.</p> |
| 79 |
</li> |
| 80 |
<ul> |
| 81 |
<li> |
| 82 |
<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 |
| 83 |
7</a>).</p> |
| 84 |
</li> |
| 85 |
</ul> |
| 86 |
<li> |
| 87 |
<p>The <b><font face="Courier New" color="#003258" size="4">trigger</font> </b>keyword introduces the message reception.</p> |
| 88 |
</li> |
| 89 |
<li> |
| 90 |
<p><i>value_part</i> is one of the following: (rem.: when omitted, <a href="#Example 4"> any message will be accepted</a>)</p> |
| 91 |
<ul> |
| 92 |
<li>a literal value, a constant, a variable, an expression. (see the <a href="#Example 1">example1</a>)</li> |
| 93 |
<li>a value template (see the <a href="#Example 2">example 2</a>)</li> |
| 94 |
<li>a modified template (see the <a href="#Example 3">example 3</a>)<br> |
| 95 |
</li> |
| 96 |
</ul> |
| 97 |
</li> |
| 98 |
<table border="0" width="100%" bgcolor="#C9C2BB" cellpadding="4"> |
| 99 |
<tr> |
| 100 |
<td width="100%"> |
| 101 |
<p><u>TITAN specific restriction compared to the standard:</u></p> |
| 102 |
<ul> |
| 103 |
<li> |
| 104 |
<p> modified template is not implemented. When encountered in the TTCN-3 program, an error message will be generated.</p> |
| 105 |
</li> |
| 106 |
</ul> |
| 107 |
</td> |
| 108 |
</tr> |
| 109 |
</table> |
| 110 |
<li> |
| 111 |
<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 |
| 112 |
required.</p> |
| 113 |
</li> |
| 114 |
</ul> |
| 115 |
<ul> |
| 116 |
<li> |
| 117 |
<p><i>address_reference</i> is one of the following:</p> |
| 118 |
<ul> |
| 119 |
<li>a component reference (cf. <a href="create.html"><b><font face="Courier New" color="#003258" size="4">create</font></b></a>) or the keyword <a href="system.html" |
| 120 |
target="_blank"><b><font face="Courier New" color="#003258" size="4">system</font></b></a>, in case of one-to-many connections.</li> |
| 121 |
<li> |
| 122 |
<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 |
| 123 |
system under test .</p> |
| 124 |
</li> |
| 125 |
</ul> |
| 126 |
</li> |
| 127 |
<li> |
| 128 |
<p><i>assignment_part</i> is one or both of the following:</p> |
| 129 |
<ul> |
| 130 |
<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" |
| 131 |
target="_blank"><b><font face="Courier New" color="#003258" size="4">address</font></b></a> or <a href="component.html"><b><font face="Courier New" color="#003258" |
| 132 |
size="4">component</font></b></a> type to store the address of the sender (see the <a href="#Example 5">example 5</a>).</li> |
| 133 |
<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 |
| 134 |
to store the received value (see the <a href="#Example 6:">example 6</a>).</li> |
| 135 |
</ul> |
| 136 |
</li> |
| 137 |
</ul> |
| 138 |
<hr align="left" width="50%"> |
| 139 |
<p><a name="Example 1">Example 1</a>: literal value |
| 140 |
<p><font face="Courier New">portibus_PCO.trigger (charstring:"abl") from system;</font> |
| 141 |
<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> |
| 142 |
<hr align="left" width="50%"> |
| 143 |
<p><a name="Example 2">Example 2</a>: template</p> |
| 144 |
<p><font face="Courier New">portibus_PCO.trigger (tr_MeiTemplate));</font></p> |
| 145 |
<p>The template (tr_MeiTemplate) determines what kind of messages will be accepted.</p> |
| 146 |
<hr align="left" width="50%"> |
| 147 |
<p><a name="Example 3">Example 3</a>: modified template</p> |
| 148 |
<p><font face="Courier New">portibus_PCO.trigger (modifies tr_MeiTemplate := {field1 := false});</font></p> |
| 149 |
<p>The modified template (tr_MeiTemplate) determines what kind of messages will be accepted.</p> |
| 150 |
<hr align="left" width="50%"> |
| 151 |
<p><a name="Example 4">Example 4</a>: any message reception</p> |
| 152 |
<p><font face="Courier New">portibus_PCO.trigger;</font></p> |
| 153 |
<p>Any message on port portibus_PCO will be accepted.</p> |
| 154 |
<hr align="left" width="50%"> |
| 155 |
<p><a name="Example 5">Example 5</a>: storing the sender address</p> |
| 156 |
<p><font face="Courier New">portibus_PCO.trigger (tr_MeiTemplate)) -> sender v_address;</font></p> |
| 157 |
<p>The address of the sender is stored in the variable v_address.</p> |
| 158 |
<hr align="left" width="50%"> |
| 159 |
<p><a name="Example 6:">Example 6:</a> storing the received value</p> |
| 160 |
<p><font face="Courier New">portibus_PCO.trigger (tr_MeiTemplate)) -> value v_ReceivedMessage;</font></p> |
| 161 |
<p>The received message is saved in the variable v_ReceivedMessage.</p> |
| 162 |
<hr align="left" width="50%"> |
| 163 |
<p><a name="Example 7:">Example 7:</a> receive on any port</p> |
| 164 |
<p><font face="Courier New">any port.trigger (tr_MeiTemplate)) -> value v_ReceivedMessage;</font></p> |
| 165 |
<p>The message matching the template tr_MeiTemplate and received on any port is saved to the variable v_ReceivedMessage.</p> |
| 166 |
<hr align="left" width="25%"> |
| 167 |
<hr align="left" width="25%"> |
| 168 |
<p><a HREF="BNF.html#triggerstatement">BNF definition</a> of <font face="Courier New"> trigger</font></p> |
| 169 |
</body> |
| 170 |
</html> |