
Chapter 7: Creating an Operation 177
iTool Developer’s Guide Creating a New Generalized Operation
In this example, there are no properties specific to the ExampleOp object, so we
simply call the superclass’ GetProperty method, passing in all of the keywords stored
in the
_extra structure.
Creating a SetProperty Method
The operation class SetProperty method stores property values in the operation
object’s instance data or in properties of associated objects. It should set the specified
property value, either by storing the value directly in the operation object’s instance
data or by calling another class’ SetProperty method.
Note
Any property registered with a call to the RegisterProperty method must be listed as
a keyword to the SetProperty method either of the operation class or one of its
superclasses.
See “IDLitOperation::SetProperty” (IDL Reference Guide) for additional details.
Example SetProperty Method
The following example code shows a very simple SetProperty method for the
ExampleOp operation:
PRO ExampleOp::SetProperty, _REF_EXTRA = _extra
IF (N_ELEMENTS(_extra) GT 0) THEN $
self->IDLitOperation::SetProperty, _EXTRA = _extra
END
Discussion
The SetProperty method first defines the keywords it will accept. There must be a
keyword for each property of the operation. The keyword inheritance mechanism
allows properties to be set on the
ExampleOp class’ superclasses without knowing
the names of the properties.
In this example, there are no properties specific to the
ExampleOp object, so we
simply use the N_ELEMENTS function to check whether the
_extra structure
contains any elements. If it does, we call the superclass’ SetProperty method, passing
in all of the keywords stored in the
_extra structure.