Jump to content

SomGetMethodIndex: Difference between revisions

From EDM2
Created page with "{{DISPLAYTITLE:somGetMethodIndex}} This method returns a class-specific index for a method. Not generally overridden. For backward compatibility, this method does not take an..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 9: Line 9:


==Parameters==
==Parameters==
; receiver (SOMClass) : A pointer to a SOMClass object.  
;receiver (SOMClass) : A pointer to a SOMClass object.
 
;methodId (somId) : A somId method ID.
; methodId (somId) : A somId method ID.


==Return Code==
==Return Code==
; rc (long)
; rc (long)
 
*  long - Returns a positive long if successful.
*  long       Returns a positive long if successful.  
* -1 - Returns a -1 if not successful.
* -1       Returns a -1 if not successful.


==Remarks==
==Remarks==
Line 35: Line 33:
}
}
</PRE>
</PRE>


==Related==
==Related==
===Data Structures===
===Data Structures===
* somMethodData (somapi.h)  
* somMethodData (somapi.h)


===Methods===
===Methods===
* [[somGetNthMethodData]]
* [[somGetNthMethodData]]
* [[somGetNthMethodInfo]]  
* [[somGetNthMethodInfo]]
 
[[Category:SOMClass]]
[[Category:SOMClass]]

Latest revision as of 12:45, 3 April 2025

This method returns a class-specific index for a method. Not generally overridden.

For backward compatibility, this method does not take an Environment parameter.

Original Class
SOMClass

Syntax

long somGetMethodIndex (SOMClass receiver, somId methodId)

Parameters

receiver (SOMClass)
A pointer to a SOMClass object.
methodId (somId)
A somId method ID.

Return Code

rc (long)
  • long - Returns a positive long if successful.
  • -1 - Returns a -1 if not successful.

Remarks

This method returns an index that can be used in subsequent calls to the same receiving class to determine information about the indicated (static or dynamic) method, via the methods somGetNthMethodData and somGetNthMethodInfo. The method must be appropriate for use on an instance of the receiver class; otherwise, a -1 is returned. The index of a method can change over time if dynamic methods are added to the receiver class or its ancestors. Thus, in dynamic multi-threaded environments, a critical region should be used to bracket the use of this method and of subsequent requests for method information based on the returned index.

Example Code

#include <somcls.xh>
main
{
   somEnvironmentNew();
   somId gmiId = somIdFromString("somGetMethodIndex");
   long index = _SOMClass->somGetMethodIndex(gmiId);
   somMethodData md;
   boolean rc = _SOMClass->somGetNthMethodData(index,&md);
   SOM_Test(rc && somCompareIds(gmiId, md.id));
}

Related

Data Structures

  • somMethodData (somapi.h)

Methods