SOM Kernel Reference 1-99
somLookupMethod Method
Purpose
Performs name-lookup method resolution. Not generally overridden.
IDL Syntax
somMethodPtr somLookupMethod (in somId methodId);
Note: For backward compatibility, this method does not take an Environment parameter.
Description
The somLookupMethod method uses name-lookup resolution to return the address of the
method procedure that supports the indicated method on instances of the receiver class.
The method may be either static or dynamic. If the method is not supported by the
receiving class, then NULL is returned. The SOM C and C++ usage bindings support
name-lookup method resolution by invoking somLookupMethod on the class of the object
on which a name-lookup method invocation is made.
The somLookupMethod method is like somFindSMethod except that dynamic methods
can also be returned.
As always, in order to use a method procedure pointer such as that returned by
somLookupMethod, it is necessary to typecast the procedure pointer so that the compiler
can create the correct procedure call. This means that a programmer making explicit use of
this method must either know the signature of the identified method, and from this create a
typedef indicating system linkage and the appropriate argument and return types, or make
use of an existing typedef provided by C or C++ usage bindings for a SOM class that
introduces a static method with the desired signature.
Parameters
receiver A pointer to the class whose instance method for the indicated method is
desired.
methodId A somId of the method whose method-procedure pointer is needed.
Return Value
A pointer to the method procedure that supports the method indicated by methodId.
C++ Example
#include <somcls.xh>
#include <somcm.xh>
void main()
{
somId fcpId = somIdFromString(”somFindClass”)
somId animalId = somIdFromString(”Animal”);
SOMClassMgr *cm = somEnvironmentNew();
somTD_SOMClassMgr_somFindClass findclassproc =
(somTD_SOMClassMgr_somFindClass)
_SOMClassMgr–>somLookupMethod(fcpId);
SOMClass *aCls = findclassproc(cm,animalId,0,0);
...
somFree(fcpId);
somFree(animalId);
}
Commenti su questo manuale