ITT Rule IDL Version 7.0 Manual do Utilizador Página 260

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 430
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 259
260 Chapter 10: Creating a File Writer
Creating a New File Writer iTool Developers Guide
Definition of the Init Function
Begin by defining the argument and keyword list for your Init method. The argument
and keyword list defines positional parameters (arguments) accepted by your method,
defines any keywords that will be handled directly by your method, and specifies
whether keywords not explicitly handled by your method will be passed through to
other routines called by your method via IDLs keyword inheritance mechanism. The
Init method for a file writer generally looks something like this:
FUNCTION
MyWriter
::Init,
MYKEYWORD1
= mykeyword1, $
MYKEYWORD2
= mykeyword2, ..., _REF_EXTRA = _extra
where MyWriter is the name of your file writer class and the MYKEYWORD
parameters are keywords handled explicitly by your Init function.
Note
Always use keyword inheritance (the _REF_EXTRA keyword) to pass keyword
parameters through to any called routines. (See Keyword Inheritance (Chapter 5,
Application Programming) for details on IDLs keyword inheritance mechanism.)
Superclass Initialization
The file writer class Init method should call the Init method of any required
superclass. For example, if your file writer is based on an existing file writer class,
you would call that class’ Init method:
self->
SomeFileWriterClass
::Init(_EXTRA = _extra)
where SomeFileWriterClass is the class definition file for the file writer on which
your new file writer is based.
Note
Your file writer class may have multiple superclasses. In general, each superclass’
Init method should be invoked by your class’ Init method.
Error Checking
Rather than simply calling the superclass Init method, it is a good idea to check
whether the call to the superclass Init method succeeded. The following statement
checks the value returned by the superclass Init method; if the returned value is 0
(indicating failure), the current Init method also immediately returns with a value of
0:
IF ( self->
SomeFileWriterClass
::Init(_EXTRA = _extra) EQ 0) THEN $
RETURN, 0
Vista de página 259
1 2 ... 255 256 257 258 259 260 261 262 263 264 265 ... 429 430

Comentários a estes Manuais

Sem comentários