When one object class is subclassed (inherits) from another class, there is an “Is A” relationship between them. The OBJ_ISA function is used to determine if an object class or instance is subclassed from the specified class.
To call OBJ_ISA with a string class name rather than an object instance, you must ensure that the class definition for the class you are testing is already loaded into IDL. To ensure that the class definition is loaded, create a named structure containing the class definition before calling OBJ_ISA.
For example, suppose we start with a clean IDL session (perhaps by issuing the .RESET_SESSION executive command). If we ask OBJ_ISA to tell us whether the object class IDLitVisAxis is a subclass of the IDLitVisualization class:
OBJ_ISA returns zero (false) because the IDLitVisAxis class is not defined. If we first define the class structure by calling the class definition routine directly:
OBJ_ISA returns one (true). In this case, the IDLitVisAxis class is defined, even though we have not actually created an instance of that class using the OBJ_NEW routine.
Note: If you call OBJ_ISA with an object instance rather than a string class name, the object class is already defined, and no other steps are required.
Result = OBJ_ISA(Arg, ClassName)
A byte array of the same size as Arg. Each element of the result is set to True (1) if the corresponding object class has the specified ClassName in its inheritance graph, or False (0) otherwise.
The items for which the OBJ_ISA test should be performed. Arg can be any of:
- A scalar object reference
- An array of object references
- A scalar string specifiying a object class name
- A string array specifying multiple object class names
Note: In order for OBJ_ISA to determine the class inheritance, each class specified in Arg must have already had its class definition loaded into IDL. If Arg contains object references, then IDL will already have the class definitions loaded. If Arg contains string classnames, you may need to ensure that the class definitions are loaded. To avoid the overhead of creating an object, you can simply create a named structure of the appropriate class.
A string giving the name of the class for which Arg is being tested.
Enhanced to allow the OBJ_ISA test to be performed on a string class name as well as an object instance.
This page has no user notes yet. Be the first one!