user manual

162 Chapter 7: Creating an Operation
Creating a New Data-Centric Operation iTool Developer’s Guide
Note
Any property registered with a call to the RegisterProperty method must be listed as
a keyword to the GetProperty method either of the operation class or one of its
superclasses.
See “IDLitDataOperation::GetProperty” (IDL Reference Guide) for additional
details.
Example GetProperty Method
The following example code shows a very simple GetProperty method for the
ExampleDataOp operation:
PRO ExampleDataOp::GetProperty, $
BYTETOP = byteTop, _REF_EXTRA = _extra
IF ARG_PRESENT(byteTop) THEN BEGIN
byteTop = self._byteTop
ENDIF
; get superclass properties
IF (N_ELEMENTS(_extra) GT 0) THEN $
self->IDLitDataOperation::GetProperty, _EXTRA = _extra
END
Discussion
The GetProperty method first defines the keywords it will accept. There must be a
keyword for each property of the operation type. The keyword inheritance
mechanism allows properties to be retrieved from the
ExampleDataOp class’
superclasses without knowing the names of the properties.
Using the ARG_PRESENT function, we check for the presence of keywords in the
call to the GetProperty method. If a keyword is detected, we retrieve the value of the
associated property. In this example, only one property (ByteTop) is specific to the
ExampleDataOp object. We retrieve the value of the ByteTop property directly from
the
ExampleDataOp object’s instance data.
Finally, we 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