1-62 SOMobjects Base Toolkit: Programmer’s Reference Manual
SOM_ResolveNoCheck Macro
Purpose
Obtains a pointer to a static method procedure, without doing consistency checks.
Syntax
somMethodPtr SOM_ResolveNoCheck (
SOMObject objPtr,
<token> className,
<token> methodName);
Description
The SOM_ResolveNoCheck macro invokes the somResolve function to obtain a pointer to
the method procedure that implements the specified method for the specified object. This
pointer can be used for efficient repeated invocations of the same method on the same type
of objects. The name of the class that introduces the method and the name of the method
must be known at compile time. Otherwise, use the somFindMethod or
somFindMethodOk method.
The SOM_ResolveNoCheck macro can only be used to obtain a method procedure for a
static method (one defined in the IDL specification for a class) and not a method added to a
class at run time. Unlike the SOM_Resolve macro, the SOM_ResolveNoCheck macro
does not perform any consistency checks on the object pointed to by objPtr.
Parameters
objPtr A pointer to the object to which the resolved method procedure will be
applied.
className The name of the class that introduces methodName. This name should be
given as a simple token, rather than a quoted string (for example, Animal
rather than “Animal”).
methodName The name of the method to be resolved. This name should be given as a
simple token, rather than a quoted string (for example, setSound rather
than “setSound”).
Expansion
The SOM_ResolveNoCheck macro uses the className and methodName to construct an
expression whose value is the method token for the specified method, then invokes the
somResolve function. Thus, the macro expands to an expression that represents the
entry-point address of the method procedure. This value can be stored in a variable and
used for subsequent invocations of the method.
Example
Animal myObj = AnimalNew();
somMethodProc *procPtr;
procPtr = SOM_ResolveNoCheck(myObj, Animal, setSound)
Related Information
Macros: SOM_Resolve
Functions: somResolve, somClassResolve, somResolveByName
Methods: somDispatch, somClassDispatch, somFindMethod, somFindMethodOk
Komentáře k této Příručce