OBJ_VALID
Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also
The OBJ_VALID function verifies the validity of its argument object references, or alternatively returns a vector of references to valid objects.
Syntax
Result = OBJ_VALID( [Arg] [, /CAST] [, COUNT=variable] )
Return Value
If called with an integer or array of object references as its argument, OBJ_VALID returns a byte array of the same size as the argument. Each element of the result is set to True (1) if the corresponding object reference in the argument refers to an existing object, and False (0) otherwise.
If called with an integer or array of integers as its argument and the CAST keyword is set, OBJ_VALID returns an array of object references. Each element of the result is a reference to the heap variable indexed by the integer value. Integers used to index heap variables are shown in the output of the HELP and PRINT commands. This is useful primarily in programming/debugging when the you have lost a reference but see it with HELP and need to get a reference to it interactively in order to determine what it is and take steps to fix the code. See the "Examples" section below for an example.
If no argument is specified, OBJ_VALID returns a vector of references to all existing valid objects. If no valid objects exist, a scalar null object reference is returned.
Arguments
Arg
An object reference or array of object references. If the CAST keyword is set, then Arg should contain a scalar integer or array of integers.
Keywords
CAST
Set this keyword to cast integers contained in Arg to their corresponding object references, and to return the object references in Result. If an integer contained in Arg does not correspond to a valid object reference, a null object is returned in that integer's place. If Arg contains object references rather than integers, the object references are simply returned. See the "Examples" section below for an example.
COUNT
Set this keyword equal to a named variable that will contain the number of currently valid objects. This value is returned as a longword integer.
Examples
To determine if a given object reference refers to a valid heap variable, use:
To destroy all existing pointer heap variables:
You can use the CAST keyword to "reclaim" lost object references. For example:
The IDL output looks something like this (the valid objects already in memory will affect the output):
Version History