07.07.2015 Views

COM/MTS Guide - Prolifics

COM/MTS Guide - Prolifics

COM/MTS Guide - Prolifics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Implementing MethodsImplementing MethodsA method supported by a component is a piece of work that a client can request thecomponent to perform. The component implements each of its methods by means of afunction (written in C, JPL or Java) that has the same name as the method's name.Implementing Methods in JPLTo implement a method in JPL, the JPL procedure must be in scope when the servicecomponent is open at runtime. The simplest way to do this is to use the Templateoption on the Change Methods dialog to write a JPL procedure to the clipboard andthen paste that procedure in the screen-level JPL (under Procedures→JPLProcedures). However, the procedure could also be written in a separate JPL moduleand made available with include or public commands.A JPL procedure that implements a component's method gets no parameters passeddirectly to it. To gain access to the method's in and in/out parameters, as sent by theclient making the method request, use the receive_args command. For example, asample JPL implementation of a component's method would be:proc my_method(){vars id, namereceive_args (id, name, address, city, state, phone). . .}The JPL command receive_args is followed by a list of targets. The values of thein and in/out parameters from the method call are placed in these target locations.The out parameters are skipped, therefore if a given method call has two outparameters, the first and third, only the values of the second, fourth and followingparameters would be copied into the target list for the receive_args command.The items in the target list must have a valid JPL syntax. In the example above, the firsttwo items on the target list are variables declared locally in the procedure. For thetarget list to be valid, the latter four items on the target list must correspond to fields<strong>COM</strong>/<strong>MTS</strong> <strong>Guide</strong> 3-13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!