
Chapter 9: Creating a File Reader 235
iTool Developer’s Guide Creating a New File Reader
See “IDLitReader” (IDL Reference Guide) for details on the methods and properties
available to classes that subclass from IDLitReader.
Example Class Structure Definition
The following is the class structure definition for the ExampleReader file reader
class. This procedure should be the last procedure in a file named
examplereader__define.pro.
PRO ExampleReader__Define
struct = { ExampleReader, $
INHERITS IDLitReader $
}
END
Discussion
The purpose of the structure definition routine is to define a named IDL structure
with structure fields that will contain the visualization object instance data. The
structure name should be the same as the visualization’s class name — in this case,
ExampleReader.
Like many iTool file reader classes,
ExampleReader is created as a subclass of the
IDLitReader class. File reader classes that subclass from IDLitReader class inherit all
of the standard iTool file reader features, as described in “Subclassing from the
IDLitReader Class” on page 234.
The ExampleReader class has no instance data of its own. For a more complex
example, see “Example: TIFF File Reader” on page 248.
Creating an Init Method
The file reader class Init method handles any initialization required by the file reader
object, and should do the following:
• define the Init function method, using the keyword inheritance mechanism to
handle “extra” keywords
• call the Init methods of any superclasses, using the keyword inheritance
mechanism to pass “extra” keywords
• register any properties of your file reader, and set property attributes as
necessary
• perform other initialization steps as necessary