SomResolve

This function obtains a pointer to the procedure that implements a method for a particular SOM object.

Syntax
 SOMObject      obj; somMToken      mToken; somMethodPtr   rc;

rc = somResolve(obj, mToken); 

Parameters

 * obj (SOMObject) : A pointer to the object whose method procedure is required.


 * mToken (somMToken) : 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" (i.e., at XYZClassData.foo). Method tokens can also be obtained using the somGetMethodToken method.

Return Code

 * rc (somMethodPtr) : A pointer to the somMethodProc (procedure) that implements the specified method for the specified SOM object.

Remarks
This function returns a pointer to the procedure that implements the specified method for the specified SOM object. This pointer can then be used to invoke the method. The somResolve function can only be used to obtain a method procedure for a static method (one declared in an IDL or OIDL specification for a class); dynamic methods are not supported by method tokens.

For C and C++ programmers, the SOM usage bindings for SOM classes provide more convenient mechanisms for invoking methods. These bindings use the SOM_Resolve and SOM_ResolveNoCheck macros, which construct a method token expression from the class name and method name, and call somResolve.

Example Code
 // SOM IDL for class A and class B module srExample { interface A : SOMObject { void foo;  implementation { callstyle=oidl; }; }; interface B : A {  implementation { foo: override; }; }; };
 * 1) include 

// Example C++ program to implement and test module scrExample
 * 1) define SOM_Module_srexample_Source
 * 2) include 
 * 3) include 

SOM_Scope void SOMLINK srExample_Afoo(srExample_A *somSelf); { printf("1\n"); }

SOM_Scope void SOMLINK srExample_Bfoo(srExample_B *somSelf); { printf("2\n"); }

main { srExample_B  objPtr = srExample_BNew;

/* This prints 2 */ ((somTD_srExample_A_foo) /* this method procedure expression cast is necessary */ somResolve(objPtr, srExample_AClassData.foo)  )     /* end of method procedure expression */ (objPtr); }



Data Structures

 * somMethodPtr (sombtype.h)
 * somMToken (somapi.h)

Functions

 * somResolveByName
 * somParentResolve
 * somParentNumResolve
 * somClassResolve

Methods

 * somDispatch
 * somClassDispatch
 * somFindMethod
 * somFindMethodOk
 * somGetMethodToken

Macros

 * SOM_Resolve
 * SOM_ResolveNoCheck