Titan



check


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 the queue. It can be used to check the top element of the port queue or to check whether anything waits for processing in the port queue

Related keywords:


1. Checking the top element of the port queue


port_reference.check ( communication_operation  );  


2. Checking whether anything waits for processing in the port queue


port_reference.check [ from address_reference ] [ -> sender address_reference ];  


Example 1: catch

MyPort2_PCO.check(catch(S_MyProc, tr_MyTemplate(5, v_MyVar)));

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 then, when the exception matches the criteria described by the template tr_MyTemplate.


Example 2:getcall

MyPort2_PCO.check(getcall(S_MyProc:{5, MyVar}) from v_MyPartner);

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 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.


Example 3: getreply

MyPort2_PCO.check(getreply(S_MyProc1:{?, v_MyVar} value *) -> value vl_MyReturnValue param(pl_MyPar1,-));

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 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 returned value does not matter) .The returned value is saved in the variable v_MyReturnValue.


Example 4: receive 

any port.check(receive(5));

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 five.


Example 5: checking anything

MujPort_PCO.check;

 Checks whether anything waits for processing in the port queue at  MujPort_PCO.


Example 6: checking anything on any port

any port.check (from v_MyPartner);

Checks whether anything from v_MyPartner waits for processing in any port queue.


Example 7: checking anything on any port and saving the sender

any port.check (-> sender v_MyNewPartner);

Checks whether anything waits for processing in any port queue. The address of the sender is saved in the variable v_MyNewPartner.



BNF definition of check