A SERVICE OF

logo

234 Chapter 9: Creating a File Reader
Creating a New File Reader iTool Developer’s Guide
Creating a New File Reader
An iTool file reader class definition file must (at the least) provide methods to
initialize the file reader class, get and set property values, handle changes to the
underlying data, clean up when the file reader is destroyed, and define the file reader
class structure. Complex file reader types will likely provide additional methods.
The process of creating an file reader is outlined in the following sections:
“Creating the Class Structure Definition” on page 234
“Creating an Init Method” on page 235
“Creating a Cleanup Method” on page 240
“Creating a GetProperty Method” on page 240
“Creating a SetProperty Method” on page 241
“Creating an IsA Method” on page 242
“Creating a GetData Method” on page 243
Creating the Class Structure Definition
When any IDL object is created, IDL looks for an IDL class structure definition that
specifies the instance data fields needed by an instance of the object, along with the
data types of those fields. The object class structure must have been defined before
any objects of the type are created. In practice, when the IDL OBJ_NEW function
attempts to create an instance of a specified object class, it executes a procedure
named
ObjectClass
__define (where ObjectClass is the name of the object),
which is expected to define an IDL structure variable with the correct name and
structure fields. For additional information on how IDL creates object instances, see
“The Object Lifecycle” (Chapter 13, Object Programming).
Note
The class structure definition is generally the last routine in the
.pro file that
defines an object class.
Subclassing from the IDLitReader Class
The IDLitReader class is the base class for all iTool file readers. In almost all cases,
new file readers will be subclassed either from the IDLitReader class or from a class
that is a subclass of IDLitReader.