Jump to content

SomResolveByName: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
mNo edit summary
 
Line 12: Line 12:


==Parameters==
==Parameters==
; obj (SOMObject) : A pointer to the object whose method procedure is required.  
;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.
; methodName (string) : A character string representing the name of the method to be resolved.  


==Return Code==
==Return Code==
; rc (somMethodPtr) : A pointer to the somMethodProc (procedure) that implements the specified method for the specified SOM object.  
;rc (somMethodPtr): A pointer to the somMethodProc (procedure) that implements the specified method for the specified SOM object.


==Remarks==
==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 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.  
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
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==
==Example Code==
Line 38: Line 37:


==Related==
==Related==
===Data Structures===
;Data Structures
* somMethodPtr (sombtype.h)  
* somMethodPtr (sombtype.h)
* SOMObject (somobj.idl)  
* SOMObject (somobj.idl)
* 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 function]]

Latest revision as of 05:04, 6 May 2020

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