Jump to content

SomResolveByName: Difference between revisions

From EDM2
Created page with "This function obtains a pointer to the procedure that implements a method for a particular SOM object. ==Syntax== <PRE> SOMObject obj; string methodName; somMe..."
 
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:somResolveByName}}
This function obtains a pointer to the procedure that implements a method for a particular SOM object.
This function obtains a pointer to the procedure that implements a method for a particular SOM object.


Line 42: Line 43:
* string (somcorba.h)  
* string (somcorba.h)  
===Functions===  
===Functions===  
* somResolve  
* [[somResolve]]
* somParentResolve  
* [[somParentResolve]]
* somParentNumResolve  
* [[somParentNumResolve]]
* somClassResolve  
* [[somClassResolve]]
===Methods===
===Methods===
* somDispatch  
* [[somDispatch]]
* somClassDispatch  
* [[somClassDispatch]]
* somFindMethod  
* [[somFindMethod]]
* somFindMethodOk  
* [[somFindMethodOk]]
===Macros===  
===Macros===  
* SOM_Resolve  
* [[SOM_Resolve]]
* SOM_ResolveNoCheck  
* [[SOM_ResolveNoCheck]]


[[Category:SOM Kernel]]
[[Category:SOM Kernel]]

Revision as of 03:30, 13 October 2017

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

Syntax

SOMObject       obj;
string          methodName;
somMethodPtr    rc;

rc = somResolveByName(obj, methodName);

Parameters

obj (SOMObject)
A pointer to the object whose method procedure is required.
methodName (string)
A character string representing the name of the method to be resolved.

Return Code

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

Remarks

This function is used to obtain a pointer to the procedure that implements the specified method for the specified SOM object. The returned procedure pointer can then be used to invoke the method. The C and C++ usage bindings use this function to support name-lookup methods.

This function can be used for invoking dynamic methods. However, the C and C++ usage bindings for SOM classes do not support dynamic methods, thus typedefs necessary for the use of dynamic methods are not available as with static methods. The function somApply provides an alternative mechanism for invoking dynamic methods that avoids the need for casting procedure pointers.

Assuming the static method "setSound," is introduced by the class "Animal", the following example will correctly invoke this method on an instance of "Animal" or one of its descendent classes

Example Code

#include <animal.h>
example(Animal myAnimal)
{
somTD_Animal_setSound
   setSoundProc = somResolveByName(myAnimal, "setSound");
setSoundProc(myAnimal, "Roar!");
}

Related

Data Structures

  • somMethodPtr (sombtype.h)
  • SOMObject (somobj.idl)
  • string (somcorba.h)

Functions

Methods

Macros