Updated PCI IDs to latest snapshot.
[tangerine.git] / rom / oop / getmethod.c
blob02f0d65537d2428b1ae686378fbcddd266f62d0d
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Get a pointer to a method for an object
6 Lang: english
7 */
8 #include <exec/lists.h>
9 #include <proto/exec.h>
10 #include <oop/oop.h>
11 #include <aros/debug.h>
12 #include "intern.h"
14 /*****************************************************************************
16 NAME */
17 #include <proto/oop.h>
19 AROS_LH2(VOID *, OOP_GetMethod,
21 /* SYNOPSIS */
22 AROS_LHA(OOP_Object *, obj, A0),
23 AROS_LHA(OOP_MethodID, mid, D0),
25 /* LOCATION */
26 struct Library *, OOPBase, 21, OOP)
28 /* FUNCTION
29 Get a specific method function for a specific object and
30 a specific interface. This a direct pointer to the method implementation.
31 The pointer should ONLY be used on the object you aquired.
33 INPUTS
34 obj - pointer to object to get method for.
35 mid - method id for method to get. This may be obtained with GetMethodID()
37 RESULT
38 The method asked for, or NULL if the method does not exist in
39 the object's class.
41 NOTES
42 !!! Use with EXTREME CAUTION. Very few programs need the extra speed gained
43 by calling a method directly
44 !!!
46 EXAMPLE
48 BUGS
49 It returns VOID *. I got compiler errors when returning
50 IPTR (*)(Class *, Object *, Msg)
52 SEE ALSO
53 OOP_GetMethodID()
55 INTERNALS
57 HISTORY
58 29-10-95 digulla automatically created from
59 intuition_lib.fd and clib/intuition_protos.h
61 *****************************************************************************/
63 AROS_LIBFUNC_INIT
65 struct IFMethod *ifm;
67 /* First get mid */
68 /* Get the method from the object's class */
69 ifm = meta_findmethod((OOP_Object *)OOP_OCLASS(obj), mid, (struct Library *)OOPBase);
70 if (NULL == ifm)
71 return NULL;
73 /* Paranoia */
74 if (NULL == ifm->MethodFunc) {
75 D(bug("!!! OOP/GetMethod(): IFMethod instance had no methodfunc. This should NEVER happen !!!\n"));
76 return NULL;
79 return (VOID *)ifm->MethodFunc;
81 AROS_LIBFUNC_EXIT
82 } /* OOP_GetMethod */