Bull DPX/20 Guia do Utilizador Página 144

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 424
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 143
1-132 SOMobjects Base Toolkit: Programmers Reference Manual
somDestruct Method
Purpose
Uninitializes the receiving object, and (if so directed) frees object storage after
uninitialization has been completed. Replaces somUninit as the preferred method for
uninitializing objects. For performance reasons, it is recommended that somDestruct
always be overridden. Not normally invoked directly by object clients.
Syntax
void somDestruct (in octet dofree, inout somDestructCtrl ctrl);
Description
Every class must support the somDestruct method. This is accomplished either by
overriding somDestruct (in which case a specialized stub procedure will be generated in
the implementation template file), or else SOMobjects will automatically provide a generic
procedure that implements somDestruct for the class. The generic procedure calls
somUninit (if this was overridden) to perform local uninitialization, then completes
execution of the method appropriately.
Because the specialized stub procedure generated by the template emitter is more efficient
than the generic procedure provided when somDestruct is not overridden, it is
recommended that somDestruct always be overridden. The stub procedure that is
generated in this case requires no modification for correct operation. The only modification
appropriate within this stub procedure is to uninitialize locally introduced instance variables.
See Section 5.5, “Initializing and Uninitializing Objects,” of the SOMobjects Developer
Toolkit Users Guide for further details.
Uninitialization with somDestruct executes as follows: For any given class in the ancestor
chain, somDestruct first uninitializes that class’s introduced instance variables (if this is
appropriate), and then calls the next ancestor class’s implementation of somDestruct,
passing 0 (that is, false) as the interim dofree argument. Then, after all ancestors of the
given class have been uninitialized, if the class’s own somDestruct method were originally
invoked with dofree as 1 (that is, true), then that object’s storage is released.
Note: It is not appropriate to override both somDestruct and somUninit. If this is done,
the somUninit code will not be executed. The best way to convert an old class that
overrides somUninit to use of the more efficient somDestruct (if this is desired) is
as follows: (1) Replace the somUninit override in the class’s .idl file with an override
for somDestruct, (2) run the emitter to produce a stub procedure for somDestruct
in the implementation template file, and then (3) simply call the class’s somUninit
procedure directly (not using a method invocation) from the somDestruct
procedure.
Vista de página 143
1 2 ... 139 140 141 142 143 144 145 146 147 148 149 ... 423 424

Comentários a estes Manuais

Sem comentários