A SERVICE OF

logo

Chapter 10: Creating a File Writer 259
iTool Developer’s Guide Creating a New File Writer
Example Class Structure Definition
The following is the class structure definition for the ExampleWriter file writer
class. This procedure should be the last procedure in a file named
examplewriter__define.pro.
PRO ExampleWriter__Define
struct = { ExampleWriter, $
INHERITS IDLitWriter $
}
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,
ExampleWriter.
Like many iTool file writer classes,
ExampleWriter is created as a subclass of the
IDLitWriter class. File writer classes that subclass from the IDLitWriter class inherit
all of the standard iTool file writer features, as described in “Subclassing from the
IDLitWriter Class” on page 258.
The ExampleWriter class has no instance data of its own. For a more complex
example, see “Example: TIFF File Writer” on page 272.
Creating an Init Method
The file writer class Init method handles any initialization required by the file writer
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 writer, and set property attributes as
necessary
perform other initialization steps as necessary
return the value 1 if the initialization steps are successful, or 0 otherwise