somGetMethodIndex

From EDM2
Jump to: navigation, search

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