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

Value and Item Passing Arguments and Return Types for RPCs

All item instances have system-defined attributes, such as Notes, Names, and Item-configuration. User-defined classes usually include user attributes, defined by the user in the class definition.

Using a remote procedure declaration, you can specify which values, user-defined attributes or user-accessible system-defined attributes you want to pass to or from a remote G2.

You can pass any value to a remote G2. Since structure and sequence values can consist of items as their attributes and elements, and those items include their own attributes and values, the RPC grammar for specifying a value argument lets you specify attributes and values. For more information about value passing, see Value Passing.

G2 can pass an item in various ways, including:

You can specify one or more of these possibilities as part of the remote procedure declaration syntax.

The following figures illustrate the grammar that you can use in G2 remote procedure declarations:

Grammar for Remote Procedure Declarations


Argument Grammar for Remote Procedure Declarations


Item-Passing Argument Grammar for RPC Declarations



Note: In a list of argument- or return types, specifying class as an argument followed by anything more than a class-name, requires that you enclose the argument or return type in parentheses, followed by a comma if other arguments follow.

Considerations for Item Passing

Before completing the required steps for item passing, consider these things:

Creating Compatible Definitions

Compatible definitions must exist on both the client and the server G2 when you pass user-defined items between two G2s. The system defined items have compatible definitions automatically.

For user-defined classes, the degree of definitional compatibility can vary. At the very least, the two definitions must have the same class name. For example, to pass an item called PC, a definition for an item called must PC exist in both the client and the server KBs.

Compatible definitions do not have to be identical, and the attributes in one definition can be a subset of the other. For a receiving definition to contain a subset of the sending definition's attributes, you can use the statements for including or excluding particular attributes in the remote procedure declaration.

Aligning User-Defined Attributes

User-defined attributes passed from one G2 process to another must be of the same name and type in both definitions. For instance, you could not define a user-attribute in one definition like this:

and specify the attribute as temp is an integer, in the other definition. The attribute temp must be either an integer or given by a quantitative variable in both definitions to pass that attribute successfully between two G2 processes.

Accumulating Transient Items

Item passing creates a transient item on either the local or remote G2. As with any transient item, you can handle placing the item on a workspace, or manipulating it in any other way, programmatically.

Keep memory resources in mind when using item passing. All transient items consume memory, so you must explicitly delete them when they are no longer needed. For additional information, see Chapter 45, Memory Management.

If your KB needs to maintain the items that are passed to it, make the transient items permanent, using the make permanent action. For more information on this action, see make.

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

Copyright © 1997 Gensym Corporation, Inc.