The features described in this topic are obsolete
and should not be used in new IDL code.
get_idl_variable
Syntax
Description
Call this function to retrieve the value of an IDL variable in the IDL session referred to by client. Any scalar or array variable type can be retrieved. Variables can be retrieved only from the main program level.
Note that it is not possible to get the value of an IDL structure. To retrieve values from an IDL structure, "decompose" the structure into regular variables in IDL, then use this function to get the values of those individual variables.
It is not possible to get the value of IDL system variables directly. To retrieve the value of an IDL system variable, first copy it to a regular IDL variable. The value of the regular variable can then be retrieved with get_idl_variable. For example:
varinfo_t pt; /* Declare variable pt */ send_idl_command(client, "X = !P.T"); get_idl_variable(client, "X", &pt, 0);
Parameters
client
A pointer to the CLIENT structure that corresponds to the desired IDL session.
name
A null terminated string that contains the name of the IDL variable to be retrieved. Only the first MAXIDLEN characters of this string are used. MAXIDLEN is defined in the file idldir/external/rpc/rpc_idl.h.
var
The address of a varinfo_t structure in which to store the returned variable information. Upon return, the Name field of the var structure contains the name of the variable as found in IDL. If the name supplied is an illegal IDL variable name, the Name field is set to <ILLEGAL_NAME>. If the variable is a structure or associated variable, the Name field is set to <BAD-VAR-TYPE>.
typecode
If you want IDL to typecast a variable (i.e., guarantee the value to be of a particular type) before it is transported, set typecode to one of the following values (defined in the file export.h):
IDL_TYP_BYTE, IDL_TYP_INT, IDL_TYP_LONG, IDL_TYP_FLOAT, IDL_TYP_DOUBLE, IDL_TYP_STRING, IDL_TYP_COMPLEX, IDL_TYP_DCOMPLEX
For example, the command:
guarantees that the value in x is returned as a 32-bit integer.
If typecode is 0, the variable is transferred with whatever data type it has in the server. Typecasting only affects the variables in the client – the server side is not affected.
Return Value
This function returns a status value that denotes the success or failure of this function as described below.
-1 Failure: bad arguments supplied (e.g., name or var is NULL).
0 RPC mechanism failed (an error message may also be printed).
1 Success
-2 Illegal variable name (e.g., "213xyz", "#a", "!DEVICE")
-3 Variable not transportable (e.g., the variable is a structure or associated
variable)