A SERVICE OF

logo

248 Chapter 9: Creating a File Reader
Example: TIFF File Reader iTool Developer’s Guide
Example: TIFF File Reader
This example creates a file reader to read TIFF format files.
Example Code
The code for this example file reader is included in the file
example1_readtiff__define.pro in the examples/doc/itools
subdirectory of the IDL distribution. Run the example procedure by entering
example1_readtiff__define at the IDL command prompt or view the file in
an IDL Editor window by entering .EDIT example1_readtiff__define.pro.
Note
The standard TIFF file reader included with the iTools contains additional features
not included in this example. In most cases, if a file reader is included in the
standard iTool distribution, there is no need to create your own reader for files of
the same type.
Class Definition File
The class definition for example1_readtiff consists of an Init method, an IsA
method, a GetData method, GetProperty and SetProperty methods, and a class
structure definition routine. As with all object class definition files, the class structure
definition routine is the last routine in the file, and the file is given the same name as
the class definition routine (with the suffix
.pro appended).
Class Definition
PRO example1_readtiff__Define
struct = {example1_readtiff, $
inherits IDLitReader, $
_index : 0 $
}
END
Discussion
Our class definition routine is very simple. We create an IDL structure variable with
the name
example1_readtiff, specifying that the structure inherits from the
IDLitReader class. The structure has a single instance data field named
_index,
which we specify as an integer value.