SOM Kernel Reference 1-7
somClassResolve Function
Purpose
Obtains a pointer to the procedure that implements a static method for instances of a
particular SOM class.
Syntax
somMethodPtr somClassResolve (SOMClass cls, somMToken mToken);
Description
The somClassResolve function is used to obtain a pointer to the procedure that
implements the specified method for instances of the specified SOM class. The returned
procedure pointer can then be used to invoke the method. The somClassResolve function is
used to support “casted” method calls, in which a method is resolved with respect to a
specified class rather than the class of which an object is a direct instance. The
somClassResolve function can only be used to obtain a method procedure for a static
method (a method declared in an IDL specification for a class); dynamic methods do not
have method tokens.
The SOM language usage bindings for C and C++ do not support casted method calls, so
this function must be used directly to achieve this functionality. Whenever using SOM
method procedure pointers, it is necessary to indicate the use of system linkage to the
compiler. 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 this purpose. The
name of the typedef is based on the name of the class that introduces the method, as
illustrated in the following example.
Parameters
cls A pointer to the class object whose instance method procedure is required.
mToken The method token for the method to be resolved. The SOM API requires
that if the class “XYZ” introduces the static method “foo”, then the method
token for “foo” is found in the class data structure for “XYZ” (called
XYZClassData) in the structure member named “foo” (that is, at
XYZClassData.foo). Method tokens can also be obtained using the
somGetMethodToken method.
Return Value
A somMethodPtr pointer to the procedure that implements the specified method for the
specified class of SOM object.
Commenti su questo manuale