| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (7 out of 11)

Value Passing

The G2 to G2 interface lets you pass values to and get values from a remote G2 process.

The argument and return types for a remote procedure declaration can be of any value type:

When passing an argument or return value declared as a structure or sequence, G2 passes the value in its entirety. You cannot specify that some attributes and values of a structure, or certain elements of a sequence, be passed.

Since structure and sequence values can include items, which include user- or system-defined attributes, the RPC argument and return value grammar lets you specify one or more user- or system-defined attributes and their values, just as you would when passing an item, rather than a value.

For the grammar to specify user- or system-defined attributes, see the various sections under Passing User- and System-Defined Classes.

In a list of arguments, each must be separated by a comma, or parentheses and a comma when specifying a class, as described in Value and Item Passing Arguments and Return Types for RPCs.

Configuring the KB for Value Passing

You configure your KB to pass a value to a remote G2 by using a remote procedure declaration (RPC).

To configure a KB for value passing using an RPC:

  1. Create a data interface object and complete it as explained in Creating Data Interface Objects.

  2. Create a procedure on the remote G2 that declares one or more values as an argument and/or as a return value.

  3. In the client G2, create a remote procedure declaration with the correct arguments of the procedure on the remote G2.

  4. In the client G2, create a rule or procedure that starts or calls the remote procedure across the appropriate data interface object to obtain a value.

Example of Passing an Integer Value

As a simple example of passing an integer value, the two procedures below illustrate:

  1. A procedure in the local G2 that calls a remote procedure across the kmann-to-jmann data interface object.

  2. The remote procedure that returns the number of items on one of its workspaces.


Example of Passing a Structure Value

Whenever you pass a structure or sequence to or obtain a structure or sequence from a remote system, G2 includes all of the attributes or elements of that value. If a structure attribute consists of an item, you can optionally choose which user- or system-defined attributes of that item to pass.

As a basic example of passing a structure value, the two procedures below illustrate:

  1. A procedure in the local G2 that calls the remote COMPOSITE-VALUE-PROC procedure and displays the results.

  2. The remote procedure, which obtains a structure representing the History-keeping-spec of a variable called V1, and returns that structure to the local G2.


| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (7 out of 11)

Copyright © 1997 Gensym Corporation, Inc.