The IDLDehydrate function takes its input argument and transforms it into IDL primitives or collections of IDL primitives. This is useful for storage and transmission of object state. It is used by IDL Task Engine to provide output in a serialized form. IDL primitives are the numeric and string types. The return value of this function can be passed into the IDLHydrate function to create a clone of the input.
All IDL Data Types are supported by IDLDehydrate, except for Null, Structure, and Pointer. Any Object that implements a Dehydrate function method is supported as well.
IDLDehydrate returns the following based on input:
- Scalar or array IDL primitive input return the same value, except for COMPLEX and DCOMPLEX input.
- COMPLEX and DCOMPLEX input generate a Hash that separates the real and imaginary components into separate arrays.
- Scalar object input causes the class's Dehydrate static function method, which must return a Hash the represents the object.
- Object array input generates a List that contains the Hash returned by the object's Dehydrate function method.
Dehydrate a scalar number
PRINT, IDLDehydrate(!DPI), /IMPLIED
Dehydrate a scalar complex number
PRINT, IDLDehydrate(COMPLEX(1, 2)), /IMPLIED
Dehydrate a list
value = LIST('one', 2.0, 3, 4L, COMPLEX(7))
PRINT, IDLDehydrate(value), /IMPLIED
Result = IDLDehydrate(value [, ERROR=error])
Returns a scalar IDL primitive value, an array of IDL primitive values, a Hash of IDL primitive values, or a List of Hashes of IDL primitive values.
The value argument can be of any IDL data type including !NULL. If an object input must implement the Dehydrate function method to be supported by this routine.
Set this keyword to a named variable that will contain any error message issued during execution. If no error occurs, the ERROR variable will be set to an empty string ('').
When this keyword is not set and an error occurs, the function returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine.