2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
5 Desc: Get a pointer to a method for an object
8 #include <exec/lists.h>
9 #include <proto/exec.h>
11 #include <aros/debug.h>
14 /*****************************************************************************
17 #include <proto/oop.h>
19 AROS_LH3(OOP_MethodFunc
, OOP_GetMethod
,
22 AROS_LHA(OOP_Object
*, obj
, A0
),
23 AROS_LHA(OOP_MethodID
, mid
, D0
),
24 AROS_LHA(OOP_Class
**, classPtr
, A1
),
27 struct Library
*, OOPBase
, 21, OOP
)
30 Get a specific method function for a specific object and
31 a specific interface. This a direct pointer to the method
32 implementation. The pointer should ONLY be used on the object you
36 obj - pointer to object to get method for.
37 mid - method id for method to get. This may be obtained with GetMethodID()
38 classPtr - A pointer to a location where implementation class pointer will be stored.
39 The obtained method must be called with this class pointer. This pointer
43 The method asked for, or NULL if the method does not exist in
47 !!! Use with EXTREME CAUTION. Very few programs need the extra speed gained
48 by calling a method directly
60 *****************************************************************************/
67 /* Get the method from the object's class */
68 ifm
= meta_findmethod((OOP_Object
*)OOP_OCLASS(obj
), mid
, (struct Library
*)OOPBase
);
72 /* Set class pointer */
73 *classPtr
= ifm
->mClass
;
76 D(if (NULL
== ifm
->MethodFunc
) bug("!!! OOP/GetMethod(): IFMethod instance had no methodfunc. This should NEVER happen !!!\n");)
78 return ifm
->MethodFunc
;