The IDL_IDLBridge::GetVar function copies the value of a variable from the child process to the parent process. The variable must exist in the child process at the $MAIN$ level. See Examples for more information.

IDL_IDLBridge::GetVar is subject to the following limitations:

  • Only scalar or array variables of numeric or string type can be transferred. Structures, pointers, and object references cannot be transferred between processes using the IDL_IDLBridge object.
  • IDL_IDLBridge::GetVar makes a copy of the data in the parent process, which may affect the performance of your application if the amount of data involved is large. In such cases, the use of shared data files or shared memory (SHMMAP and SHMVAR) may offer a more efficient way to share data.

It is not possible to call GetVar or SetVar when a child process is actively executing a command (when IDL_IDLBridge::Status equals 1).

Note: This method is disabled in IDL Virtual Machine mode.

Syntax


Result = Obj->[IDL_IDLBridge::]GetVar(VarName)

Return Value


Returns the value of the variable transferred from the child process.

Arguments


VarName

A string containing the name of the variable to be transferred from the child process.

Keywords


None

Examples


The GetVar method can return the value of a variable that exists at the $MAIN$ level of the child process. In the following example, GetVar returns image data. Note that the mrifile variable and data variable are created in the child process as a result of executing the Execute statement.

; Create a child process. 
oBridge=OBJ_NEW('IDL_IDLBridge')
 
; Access a file and pass it to the child process in a variable
; called file.
mriFile= FILEPATH('pdthorax124.jpg', $
   SUBDIRECTORY = ['examples', 'data'])
 
; Extract the image data in the child process into a 
; variable named data.
oBridge->Execute, "READ_JPEG,'" + mrifile + "', data"
 
; Access the image data using GetVar and display it.
imgData = oBridge->GetVar('data')
IIMAGE, imgData

You can also access information about a child process using the HELP procedure. For example, if you set a breakpoint in a parent IDL process at a point where IDL_IDLBridge object status can be obtained (such as during an Abort, where you can access an IDL_IDLBridge object that is not actively executing a command), you can use GetVar to return HELP information as follows:

oBridge->Execute, 'HELP, /FULL, OUTPUT=x'
PRINT, oBridge->GetVar('x')

Version History


6.3

Introduced