# getreply

The operation belongs to the family of procedure-based communication operations. It is used to handle replies from a previously called procedure.

- The operation can be used on connected procedure-based (or mixed) ports.
- In case of multiple connections the operation may be restricted to one communication partner.

Related keywords:

- address
- create
- from
- modifies
- param
- sender
- signature
- system
- value

### port_reference.getreply [ ( template_instance [ value value_match ] ) ] [ from address_reference ] [ -> assignment_part ];

- port_reference points out the port where the reply is awaited from.

  - the keywords any port may be used to indicate that replies will be accepted at any port (see the example 4).

- The getreply keyword introduces the reply to the procedure call.

- template_instance may be one of the following (when omitted, the call on the top of the incoming port queue (if any) will be removed):

  - in-line signature template (see the example1);
  - a signature template (see the example 2);
  - a modified signature template (see the example 3);

- The optional value keyword introduces the checking of the returned value (see the example 3).

- value_match may be one of the following:

  - in-line value template;
  - a receiving template;
  - a modified template.

- The optional from keyword is used when a port is connected to several entities and restriction to one communication partner is required.

- address_reference is one of the following:

  - a component reference (cf. create) or the keyword system, in case of one-to-many connections.

  - an address reference (cf. address) , when there are several entities within the system under test.

- assignment_part is one or more of the following:

  - the sender keyword followed by a variable of address or component type to store the address of the sender (see the example 2).
  - the value keyword followed by a variable of the appropriate type to store the returned value (see the example 3).
  - the param keyword followed of variables of the same type as the received message to store the received parameters (see the example 1).

Example 1: in-line signature template and parameter redirect

signature S_MyProc (out integer pl_MyPar1, inout boolean pl_MyPar2, in charset pl_MyPar3) return float;
MujPort_PCO.getreply(S_MyProc:{ 14 .. 143, ?, ?}) from system -> param (vl_MyPar1, vl_MyPar2, vl_MyPar3);

The signature S_MyProc suitable for blocking communication is defined in the first line. It has three parameters (pl_MyPar1, pl_MyPar2 and pl_MyPar3).
In the second line, the response is accepted at the port MujPort_PCO. The port is connected to several components, but communication is restricted to one component, here to the test system interface. The value of the last two parameters does not matter, but the first one must be between 14 and 143 for the response to be accepted. The parameter values are stored in the variables vl_MyPar1, vl_MyPar2 and vl_MyPar3, respectively.

Example 2: signature template, value match and address redirect

template S_MyProc t_NiaTemplate (boolean pl_param) := {
field1 := 1 .. 6,
field2 := pl_param,
field3 := "massepain"
}

MujPort_PCO.getreply (t_NiaTemplate(true) value 1.1) -> sender v_address;

The parameterized template (t_NiaTemplate) has three fields. Replies are accepted where the first parameter is between one and six; the second must have the value true and the last parameter is don't care because it is defined as an in parameter. Another requirement to be met that the returned value must be equal to 1.1. The address of the component responding to the procedure call is stored in the variable v_address.

Example 3: modified signature template and value redirect

MujPort_PCO.getreply (modifies t_NiaTemplate(false) := {field1 := 6}) -> value v_Ile_Flottante;

The template defined in example 2 is modified. The response is now accepted when the first and the second parameters have the values six and false, respectively. The returned floating point value is stored in the variable v_Ile_Flottante

Example 4: receive on any port

any port.getreply (t_NiaTemplate(true));

The response matching the template t_NiaTemplate will be accepted on any port.

Example 5: Accepting any call

MujPort_PCO.getreply;

Removes the top reply from MujPort_PCO.

BNF definition of getreply