corrections to scren bar rendering offsets
[AROS.git] / rom / oop / getmethod.c
blob8e2e682646d57d0123da5584177f572250dc5555
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_LH3(OOP_MethodFunc, OOP_GetMethod,
21 /* SYNOPSIS */
22 AROS_LHA(OOP_Object *, obj, A0),
23 AROS_LHA(OOP_MethodID, mid, D0),
24 AROS_LHA(OOP_Class **, classPtr, A1),
26 /* LOCATION */
27 struct Library *, OOPBase, 21, OOP)
29 /* FUNCTION
30 Get a specific method function for a specific object and
31 a specific interface. This a direct pointer to the method implementation.
32 The pointer should ONLY be used on the object you aquired.
34 INPUTS
35 obj - pointer to object to get method for.
36 mid - method id for method to get. This may be obtained with GetMethodID()
37 classPtr - A pointer to a location where implementation class pointer will be stored.
38 The obtained method must be called with this class pointer. This pointer
39 is mandatory!
41 RESULT
42 The method asked for, or NULL if the method does not exist in
43 the object's class.
45 NOTES
46 !!! Use with EXTREME CAUTION. Very few programs need the extra speed gained
47 by calling a method directly
48 !!!
50 EXAMPLE
52 BUGS
54 SEE ALSO
55 OOP_GetMethodID()
57 INTERNALS
59 HISTORY
60 29-10-95 digulla automatically created from
61 intuition_lib.fd and clib/intuition_protos.h
63 *****************************************************************************/
65 AROS_LIBFUNC_INIT
67 struct IFMethod *ifm;
69 /* First get mid */
70 /* Get the method from the object's class */
71 ifm = meta_findmethod((OOP_Object *)OOP_OCLASS(obj), mid, (struct Library *)OOPBase);
72 if (NULL == ifm)
73 return NULL;
75 /* Set class pointer */
76 *classPtr = ifm->mClass;
78 /* Paranoia */
79 D(if (NULL == ifm->MethodFunc) bug("!!! OOP/GetMethod(): IFMethod instance had no methodfunc. This should NEVER happen !!!\n");)
81 return ifm->MethodFunc;
83 AROS_LIBFUNC_EXIT
84 } /* OOP_GetMethod */