1-90 SOMobjects Base Toolkit: Programmer’s Reference Manual
somGetMethodIndex Method
Purpose
Returns a class-specific index for a method. Not generally overridden.
IDL Syntax
long somGetMethodIndex (in somId methodId);
Note: For backward compatibility, this method does not take an Environment parameter.
Description
The somGetMethodIndex 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.
Parameters
receiver A pointer to a SOMClass object.
methodId A somId method ID.
Return Value
The somGetMethodIndex method returns a positive long if successful, and a –1 otherwise.
C++ Example
#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));
}
Original Class
SOMClass
Related Information
Methods: somGetNthMethodData, somGetNthMethodInfo
Data Structures: somMethodData (somapi.h)
Komentarze do niniejszej Instrukcji