Bull DPX/20 Guia do Utilizador Página 92

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 424
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 91
1-80 SOMobjects Base Toolkit: Programmers Reference Manual
somFindMethod, somFindMethodOk Methods
Purpose
Finds the method procedure for a method and indicates whether it represents a static
method or a dynamic method. Not generally overridden.
IDL Syntax
boolean somFindMethod (
in somId methodId,
out somMethodPtr m);
boolean somFindMethodOk (
in somId methodId,
out somMethodPtr m);
Note: For backward compatibility, these methods do not take an Environment parameter.
Description
The somFindMethod and somFindMethodOk methods perform name-lookup method
resolution, determine the method procedure appropriate for performing the indicated
method on instances of the receiving class, and load m with the method procedure address.
For static methods, method procedure resolution is done using the instance method table of
the receiving class.
Name-lookup resolution must be used to invoke dynamic methods. Also, name-lookup can
be useful when different classes introduce methods of the same name, signature, and
desired semantics, but it is not known until runtime which of these classes should be used
as a type for the objects on which the method is to be invoked. If the signature of a method
is an unknown, then method procedures cannot be be used directly, and the somDispatch
method to be used after dynamically discovering the signature to allow the correct
arguments can be placed on a va_list.
As with any methods that return procedure pointers, these methods allow repeated
invocations of the same method procedure to be programmed. If this is done, it is up to the
programmer to prevent runtime errors by assuring that each invocation is performed either
on an instance of the class used to resolve the method procedure or of some class derived
from it. Whenever using SOM method procedure pointers, it is necessary to indicate the
arguments to be passed and the use of system linkage to the compiler, so it can generate a
correct procedure call. The way this is done depends on the compiler and the system being
used. However, C and C++ usage bindings provide an appropriate typedef for static
methods. The name of the typedef is based on the name of the class that introduces the
method, as illustrated in the following example.
Unlike the somFindMethod method, if the class does not support the specified method, the
somFindMethodOk method raises an error and halts execution.
If the class does not support the specified method, then *m is set to NULL and the return
value is meaningless. Otherwise, the returned result is true if the indicated method was a
static method.
Vista de página 91
1 2 ... 87 88 89 90 91 92 93 94 95 96 97 ... 423 424

Comentários a estes Manuais

Sem comentários