1-72 SOMobjects Base Toolkit: Programmer’s Reference Manual
somAddDynamicMethod Method
Purpose
Adds a new dynamic instance method to a class. Dynamic methods are not part of the
declared interface to a class of objects, and are therefore not supported by implementation
and usage bindings. Instead, dynamic methods provide a way to dynamically add new
methods to a class of objects during execution. SOM provides no standard protocol for
informing a user of the existence of dynamic methods and the arguments they take.
Dynamic methods must be invoked using name-lookup or dispatch resolution.
IDL Syntax
void somAddDynamicMethod (
in somId methodId,
in somId methodDescriptor,
in somMethodPtr method,
in somMethodPtr applyStub);
Note: For backward compatibility, this method does not take an Environment parameter.
Description
The somAddDynamicMethod method adds a new dynamic instance method to the
receiving class. This involves recording the method’s ID, descriptor, method procedure
(specified by method), and apply stub in the receiving class’s method data.
The arguments to somAddDynamicMethod should be non-null and obey the following
requirements. This is the responsibility of the implementor of a class, who in general has no
knowledge of whether clients of this class will require use of the applyStub argument.
Parameters
receiver A pointer to a SOM class object.
methodId A somId that names the method.
methodDescriptor
A somId appropriate for requesting information concerning the method
from the SOM IR. This is currently of the form
<className>::<methodName>.
method A pointer to the procedure that will implement the new method. The first
argument of this procedure is the address of the object on which it is being
invoked.
applyStub A pointer to a procedure that returns nothing and receives as arguments: a
method receiver; an address where the return value from the method call is
to be stored; a pointer to a method procedure; and a va_list containing the
arguments to the method. The applyStub procedure (which is usually called
by somDispatch) must unload its va_list argument into separate variables
of the correct type for the method, invoke its procedure argument on these
variables, and then copy the result of the procedure invocation to the
address specified by the return value argument.
Kommentare zu diesen Handbüchern