Class CPInvocation

CPObject
    extended byCPInvocation

@implementation CPInvocation : CPObject

A CPInvocation is an object representation of a message sent to an object.


Method Summary
+(id)invocationWithMethodSignature:(CPMethodSignature)aMethodSignature
          Returns a new CPInvocation that represents a message to a method.
-(id)initWithCoder:(CPCoder)aCoder
          Initializes the invocation with data from a coder.
-(id)initWithMethodSignature:(CPMethodSignature)aMethodSignature
          Initializes the invocation with a provided method signature.
-(id)argumentAtIndex:(unsigned)anIndex
          Returns the argument at the specified index.
-(void)encodeWithCoder:(CPCoder)aCoder
          Writes out the invocation's data to the provided coder.
-(void)invoke
          Sends the encapsulated message to the stored target.
-(void)invokeWithTarget:(id)aTarget
          Sends the encapsulated message to the specified target.
-(id)returnValue
          Returns the invocation's return value.
-(SEL)selector
          Returns the invocation's selector.
-(void)setArgument:(id)anArgument atIndex:(unsigned)anIndex
          Sets a method argument for the invocation.
-(void)setReturnValue:(id)aReturnValue
          Sets the invocation's return value.
-(void)setSelector:(SEL)aSelector
          Sets the invocation's selector.
-(void)setTarget:(id)aTarget
          Sets the invocation's target.
-(id)target
          Returns the invocation's target.

Methods inherited from class CPObject
initialize, alloc, class, instanceMethodForSelector, instancesRespondToSelector, isSubclassOfClass, load, new, setVersion, superclass, version, init, autorelease, awakeAfterUsingCoder, class, classForCoder, classForKeyedArchiver, className, copy, dealloc, description, doesNotRecognizeSelector, forwardInvocation, hash, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableCopy, performSelector, performSelector, performSelector, release, replacementObjectForArchiver, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, retain, self, superclass


Method Detail

invocationWithMethodSignature

+(id)invocationWithMethodSignature:(CPMethodSignature)aMethodSignature
Returns a new CPInvocation that represents a message to a method.
Parameters:
aMethodSignature - the signature of the method to message
Returns:
the new invocation

initWithCoder

-(id)initWithCoder:(CPCoder)aCoder
Initializes the invocation with data from a coder.
Parameters:
aCoder - the coder from which to obtain initialization data
Returns:
the initialized invocation

initWithMethodSignature

-(id)initWithMethodSignature:(CPMethodSignature)aMethodSignature
Initializes the invocation with a provided method signature
Parameters:
aMethodSignature - the signature of the method to message
Returns:
the initialized invocation

argumentAtIndex

-(id)argumentAtIndex:(unsigned)anIndex
Returns the argument at the specified index. Arguments 0 and 1 are self and _cmd respectively. Thus, method arguments start at 2.
Parameters:
anIndex - the index of the argument to return
Throws:
CPInvalidArgumentException - if anIndex is greater than or equal to the invocation's number of arguments.

encodeWithCoder

-(void)encodeWithCoder:(CPCoder)aCoder
Writes out the invocation's data to the provided coder.
Parameters:
aCoder - the coder to which the data will be written

invoke

-(void)invoke
Sends the encapsulated message to the stored target.

invokeWithTarget

-(void)invokeWithTarget:(id)aTarget
Sends the encapsulated message to the specified target.
Parameters:
aTarget

returnValue

-(id)returnValue
Returns the invocation's return value

selector

-(SEL)selector
Returns the invocation's selector

setArgument

-(void)setArgument:(id)anArgument atIndex:(unsigned)anIndex
Sets a method argument for the invocation. Arguments 0 and 1 are self and _cmd.
Parameters:
anArgument - the argument to add
anIndex - the index of the argument in the method

setReturnValue

-(void)setReturnValue:(id)aReturnValue
Sets the invocation's return value
Parameters:
aReturnValue

setSelector

-(void)setSelector:(SEL)aSelector
Sets the invocation's selector.
Parameters:
aSelector

setTarget

-(void)setTarget:(id)aTarget
Sets the invocation's target
Parameters:
aTarget - the invocation target

target

-(id)target
Returns the invocation's target

Created on Sat Sep 13 14:15:43 PDT 2008