Copyright ã1994 by NeXT Computer, Inc.  All Rights Reserved.

NSMethodSignature 

Inherits From:	NSObject

Conforms To:	NSObject (NSObject)

Declared In:	Foundation/NSMethodSignature.h 

Class Description

NSMethodSignature provides the programmatic interface to objects that provide access to the ªtype signaturesº of an object's methodsÐthat is, the types of the arguments and return value. A method signature is used by the distributed objects machinery to determine how to correctly encode method names and arguments for the underlying inter-process communications. The typical use of method signatures is when a message is sent to a remote object via a proxy. If the proxy doesn't know the types of arguments a remote object will use, the proxy first has to query the remote object for its method signature object, which specifies the types the method requires as arguments. The proxy then knows how to encode the data it has been passed and forward it correctly to the real object.

You create a method signature object by sending a signatureWithObjCTypes method to the NSMethodSignature class object, passing a ªCº-style character string which specifies the method's return types and argument types.

Given a method signature, all other available instance methods query the object for information about the signature, such as its return type, number of arguments, stack frame size (obviously architecture-dependent), and so on.

Also see NSInvocation for the class which can use method signature objects to send messages to other objects.

Creating a Method Signature

+ (NSMethodSignature *)signatureWithObjCTypes:(const char *)types
	Creates a method signature object given types, a string encoding the method return and argument types. 

Querying a Method Signature

- (NSArgumentInfo)argumentInfoAtIndex:(unsigned)index
	Returns information about the argument at index. Indices begin with 0. The ªhiddenº arguments self and _cmd are indexed at 0 and 1; method-specific arguments begin at index 2. If index is too large for the actual number of arguments, NSInvalidArgumentException is raised.

- (unsigned)frameLength	Returns the number of bytes that the arguments, taken together, would occupy on the stack. 

- (BOOL)isOneway	Returns YES if the method is asynchronous (that is, it returns without waiting for the receiver to finish processing it), and NO otherwise.

- (unsigned)methodReturnLength	Returns the number of bytes required by the return value.

- (char *)methodReturnType	Returns a string encoding the return type of the method. (What the characters in the string represent is usually defined by some implementation-dependent runtime types.)

- (unsigned)numberOfArguments	Returns the number of arguments recorded in the receiver. This will be at least two, since it includes the ªhiddenº arguments, self and _cmd, which are the first two arguments passed to every method implementation.