IPB_Session interface:
FindMatchingFunction method
Description
Finds a function that has the specified argument list.
Syntax
FindMatchingFunction(pbclass cls, LPCTSTR methodName, PBRoutineType rt, LPCTSTR readableSignature)
Argument
|
Description
|
cls
|
pbclass containing
the method.
|
methodName
|
The string name of the method in lowercase.
|
rt
|
Type of the method: PBRT_FUNCTION
for function or PBRT_EVENT for event.
|
readableSignature
|
A comma-separated string listing the
types of the method's arguments. The return type of the
method is not included in the string. See the Usage section for
examples.
|
Return Values
pbmethodID.
Examples
This example returns the method ID of a function
named uf_test that takes an integer and
a double as arguments:
pbclass cls;
pbmethodID mid;
PBCallInfo* ci = new PBCallInfo;
unsigned long ret_val;
cls = Session -> GetClass(myobj);
mid = Session -> FindMatchingFunction(cls, "uf_test",
PBRT_FUNCTION, "int, double");
Session -> InitCallInfo(cls, mid, ci);
Usage
FindMatchingFunction provides an alternative
to the GetMethodID function. It requires a list
of the function's arguments (the readableSignature)
instead of the signature obtained using the pbsig170 tool.
This table shows the readableSignature for
each of several functions.
Table 7-3: FindMatchingFunction readable signature examples
Function prototype
|
Signature
|
void test1()
|
""
|
int test2()
|
""
|
string test3(int
a, double b)
|
"int, double"
|
datastore test4(powerobject
a[], double b[2 to 10, 1 to 7])
|
"powerobject[],
double[2 to 10, 1 to 7]"
|
int test5(readonly
int a[10,20], ref long c[])
|
"readonly int[10,20], ref
long[])"
|
FindMatchingFunction does not check the
access type of the function, so you can use it to obtain the method
ID of a private function. GetMethodID cannot
obtain the method ID of a private function.
See Also
GetMethodID