| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
<html> |
| 15 |
<head> |
| 16 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 17 |
<meta http-equiv="Content-Language" content="en-us"> |
| 18 |
<title>check</title> |
| 19 |
</head> |
| 20 |
<body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258"> |
| 21 |
<table align="left" border="0" cellspacing="0" cellpadding="0" valign=top> |
| 22 |
<tr> |
| 23 |
<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> |
| 24 |
</tr> |
| 25 |
</table> |
| 26 |
<table border="0" align="right" cellpadding="0" cellspacing="0"> |
| 27 |
<tr> |
| 28 |
<td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td> |
| 29 |
<td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td> |
| 30 |
<td><a href="charstring.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td> |
| 31 |
<td><a href="clear.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td> |
| 32 |
</tr> |
| 33 |
</table> |
| 34 |
<p><br clear="all"> |
| 35 |
</p> |
| 36 |
<hr> |
| 37 |
<h1>check</h1> |
| 38 |
<hr align="left" width="75%"> |
| 39 |
<p>The keyword denotes a generic communication operation that allows read access to the top element of message-based and procedure-based incoming port queues without removing the top element from |
| 40 |
the queue. It can be used to check the <a href="#top"> top element of the port queue</a> or to check whether <a href="#something">anything waits</a> for processing in the port queue |
| 41 |
<ul> |
| 42 |
<li>If the queue is empty, the operation fails.</li> |
| 43 |
</ul> |
| 44 |
<p>Related keywords:</p> |
| 45 |
<ul> |
| 46 |
<li><a href="any.html"><b><font face="Courier New" color="#003258" size="4">any</font></b></a></li> |
| 47 |
<li><a href="catch.html"><b><font face="Courier New" color="#003258" size="4">catch</font></b></a></li> |
| 48 |
<li><a href="getcall.html"><b><font face="Courier New" color="#003258" size="4">getcall</font></b></a></li> |
| 49 |
<li><a href="getreply.html"><b><font face="Courier New" color="#003258" size="4">getreply</font></b></a></li> |
| 50 |
<li><a href="port.html"><b><font face="Courier New" color="#003258" size="4">port</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="from.html"><b><font face="Courier New" color="#003258" size="4">from</font></b></a></li> |
| 53 |
<li><a href="sender.html"><b><font face="Courier New" color="#003258" size="4">sender</font></b></a> </li> |
| 54 |
</ul> |
| 55 |
<hr align="left" width="75%"> |
| 56 |
<h4>1. Checking the <a name="top"> top</a> element of the port queue</h4> |
| 57 |
<hr align="left" width="50%"> |
| 58 |
<div align="center"> |
| 59 |
<center> |
| 60 |
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4"> |
| 61 |
<tr> |
| 62 |
<td width="100%"> |
| 63 |
<h3 align="center"><i>port_reference</i><font face="Courier New" color="#003258" size="5"><b>.check ( </b></font> <i> communication_operation </i><font face="Courier New" |
| 64 |
color="#003258" size="5"><b>);</b></font> </h3> |
| 65 |
</td> |
| 66 |
</tr> |
| 67 |
</table> |
| 68 |
</center> |
| 69 |
</div> |
| 70 |
<ul> |
| 71 |
<li> |
| 72 |
<p><i> port_reference</i> points out the port where the procedure or message is awaited.</p> |
| 73 |
<ul> |
| 74 |
<li> |
| 75 |
<p>the keywords <b><font face="Courier New" color="#003258" size="4">any port</font> </b> may be used to indicate that communication through any port will be accepted (see the <a |
| 76 |
href="#Example 4:">example 4</a>).</p> |
| 77 |
</li> |
| 78 |
</ul> |
| 79 |
</li> |
| 80 |
<li> |
| 81 |
<p>The <b><font face="Courier New" color="#003258" size="4">check</font> </b> keyword introduces the queue verification.</p> |
| 82 |
</li> |
| 83 |
<li> |
| 84 |
<p>The <i>communication_operation</i> may be one of the following :</p> |
| 85 |
<ul> |
| 86 |
<li><a href="receive.html"><b><font face="Courier New" color="#003258" size="4">catch</font></b></a> (see the <a href="#Example 1">example1</a>);</li> |
| 87 |
<li><a href="getcall.html"><b><font face="Courier New" color="#003258" size="4">getcall</font></b></a> (see the <a href="#Example 2">example 2</a>);</li> |
| 88 |
<li><a href="getreply.html"><b><font face="Courier New" color="#003258" size="4">getreply</font></b></a> (see the <a href="#Example 3">example 3</a>); </li> |
| 89 |
<li><a href="receive.html"><b><font face="Courier New" color="#003258" size="4">receive</font></b></a> (see the <a href="#Example 4:">example 4</a>).</li> |
| 90 |
</ul> |
| 91 |
</li> |
| 92 |
</ul> |
| 93 |
<hr align="left" width="75%"> |
| 94 |
<h4>2. Checking whether <a name="something" href="#Example 5">anything waits for processing in the port queue</a></h4> |
| 95 |
<hr align="left" width="50%"> |
| 96 |
<div align="center"> |
| 97 |
<center> |
| 98 |
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4"> |
| 99 |
<tr> |
| 100 |
<td width="100%"> |
| 101 |
<h3 align="center"><i>port_reference</i><font face="Courier New" color="#003258" size="5"><b>.check </b></font> [ <font face="Courier New" color="#003258" size="5"><b>from </b></font><i>address_reference</i> |
| 102 |
] [ <font face="Courier New" color="#003258" size="5"><b>-> sender</b></font><i> address_reference</i> ]<font face="Courier New" color="#003258" size="5"><b>;</b></font> </h3> |
| 103 |
</td> |
| 104 |
</tr> |
| 105 |
</table> |
| 106 |
</center> |
| 107 |
</div> |
| 108 |
<ul> |
| 109 |
<li> |
| 110 |
<p><i> port_reference</i> points out the port where the procedure or message is awaited.</p> |
| 111 |
<ul> |
| 112 |
<li> |
| 113 |
<p>the keywords <b><font face="Courier New" color="#003258" size="4">any port</font> </b> may be used to indicate that communication through any port will be accepted (see the <a |
| 114 |
href="#Example 6">example 6</a>).</p> |
| 115 |
</li> |
| 116 |
</ul> |
| 117 |
</li> |
| 118 |
<li> |
| 119 |
<p>The <b><font face="Courier New" color="#003258" size="4">check</font> </b> keyword introduces the queue verification.</p> |
| 120 |
</li> |
| 121 |
<li> |
| 122 |
<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 |
| 123 |
partner is required (see the <a href="#Example 6">example 6</a>).</p> |
| 124 |
</li> |
| 125 |
<li> |
| 126 |
<p>The optional <a href="sender.html"><b><font face="Courier New" color="#003258" size="4">sender</font></b></a> keyword is used to store the address of the sender (see the <a |
| 127 |
href="#Example 7">example 7</a>).</p> |
| 128 |
</li> |
| 129 |
<li> |
| 130 |
<p><i>address_reference</i> is one of the following:</p> |
| 131 |
<ul> |
| 132 |
<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" |
| 133 |
target="_blank"><b><font face="Courier New" color="#003258" size="4">system</font></b></a>, in case of one-to-many connections.</li> |
| 134 |
<li> |
| 135 |
<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 |
| 136 |
system under test.</p> |
| 137 |
</li> |
| 138 |
</ul> |
| 139 |
</li> |
| 140 |
</ul> |
| 141 |
<hr align="left" width="50%"> |
| 142 |
<p><a name="Example 1">Example 1</a>: catch |
| 143 |
<p><font face="Courier New">MyPort2_PCO.check(catch(S_MyProc, tr_MyTemplate(5, v_MyVar)));</font> |
| 144 |
<p>The operation is used to check whether there is an exception waiting to be caught at the port MyPort2_PCO. The signature S_MyProc defines the exception. The check operation is successful only |
| 145 |
then, when the exception matches the criteria described by the template tr_MyTemplate.</p> |
| 146 |
<hr align="left" width="50%"> |
| 147 |
<p><a name="Example 2">Example 2</a>:getcall</p> |
| 148 |
<p><font face="Courier New">MyPort2_PCO.check(getcall(S_MyProc:{5, MyVar}) from v_MyPartner);</font> |
| 149 |
<p>The operation is used to check whether there is a procedure call waiting at the port MyPort2_PCO. The signature S_MyProc defines in-line the procedure parameters. The check operation is |
| 150 |
successful only then, when the exception matches the criteria described in the in-line signature and comes from the communication partner pointed out by the variable v_MyPartner.</p> |
| 151 |
<hr align="left" width="50%"> |
| 152 |
<p><a name="Example 3">Example 3</a>: getreply</p> |
| 153 |
<p><font face="Courier New">MyPort2_PCO.check(getreply(S_MyProc1:{?, v_MyVar} value *) -> value vl_MyReturnValue param(pl_MyPar1,-));</font></p> |
| 154 |
<p>The operation is used to check whether there is a response waiting at the port MyPort2_PCO. The signature S_MyProc1 defines in-line the accepted response parameters (the first one is |
| 155 |
don't care, the second one must match the value contained in v_MyVar). The check operation is successful only then, when the exception matches the criteria described in the in-line signature (the |
| 156 |
returned value does not matter) .The returned value is saved in the variable v_MyReturnValue.</p> |
| 157 |
<hr align="left" width="50%"> |
| 158 |
<p><a name="Example 4:">Example 4:</a> receive </p> |
| 159 |
<p><font face="Courier New">any port.check(receive(5));</font></p> |
| 160 |
<p>The operation is used to check whether there is a message waiting at no matter which port. The check operation is successful only then, when the message contains the integer value |
| 161 |
five.</p> |
| 162 |
<hr align="left" width="50%"> |
| 163 |
<p><a name="Example 5">Example 5</a>: checking anything</p> |
| 164 |
<p><font face="Courier New">MujPort_PCO.check;</font></p> |
| 165 |
<p> Checks whether anything waits for processing in the port queue at MujPort_PCO.</p> |
| 166 |
<hr align="left" width="50%"> |
| 167 |
<p><a name="Example 6">Example 6</a>: checking anything on any port</p> |
| 168 |
<p><font face="Courier New">any port.check (from v_MyPartner);</font></p> |
| 169 |
<p>Checks whether anything from v_MyPartner waits for processing in any port queue.</p> |
| 170 |
<hr align="left" width="50%"> |
| 171 |
<p><a name="Example 7">Example 7</a>: checking anything on any port and saving the sender</p> |
| 172 |
<p><font face="Courier New">any port.check (-> sender v_MyNewPartner);</font></p> |
| 173 |
<p>Checks whether anything waits for processing in any port queue. The address of the sender is saved in the variable v_MyNewPartner.</p> |
| 174 |
<hr align="left" width="25%"> |
| 175 |
<hr align="left" width="25%"> |
| 176 |
<p><a HREF="BNF.html#checkstatement">BNF definition</a> of <font face="Courier New"> check</font></p> |
| 177 |
</body> |
| 178 |
</html> |