File tom/Invocation


class tom.Invocation

An Invocation is an object holding a target object, a selector, and arguments to the selector. Thus, an Invocation holds everything needed to send a message. An Invocation can be fired at its target (with the fire method), or fired after retargeting (using the fireAt method).

An Invocation is incomplete when not all arguments needed to send the message have been specified. An incomplete Invocation can be fired in two different ways. First, by invoking fireWith and supplying values for the remaining arguments. Second, by invoking on the Invocation a method completing it. For example, if an Invocation x of the method void with int a do int b only has a value for the argument a, then invoking [x do 23] will (temporarily) complete the Invocation and send the full message (with do) to its target.

Inherits

State supers
State

methods

instance (id)
   for selector sel
   to: All target = nil
  with dynamic arguments;
Create a, potentially incomplete, invocation.

instance (id)
  for selector sel
  to: All target = nil
    : Indexed arguments = nil;
Create a, potentially incomplete, invocation.

instance (id)
    of selector sel
   to: All target = nil
  with dynamic arguments;
Create a complete invocation. This raises a program-condition if the resulting invocation is incomplete.

instance (id)
   of selector sel
  to: All target = nil
    : Indexed arguments = nil;
Create a complete invocation. This raises a program-condition if the resulting invocation is incomplete.

instance (id)
     of selector sel
    to: All target = nil
  using pointer ap;
Create an invocation. It shall be complete. This method is primarily intended to be used by Proxy in its forwarding from forwardSelector arguments.

Arguments are to be retrieved from the va_list pointed to by ap, i.e. va_arg (*ap, ...).

instance tom.Invocation

variables

InvocationResult result;
The result of the most recent invocation, or nil if we haven't fired yet, or have fired with a void return type (of the fire method).
pointer invocation;
The underlying invocation structure.

methods

protected id
  init pointer i;
Designated initializer.

boolean
  isComplete;
Return TRUE iff the receiving invocation is complete, i.e. is has all the arguments needed and can be fired directly with fire or fireAt.

selector
  selector;
Return this invocation's selector.

_builtin_.Any
  target;
Return this invocation's target.

Forwarding

protected InvocationResult
  forwardSelector selector sel
        arguments pointer ap;
Forward the selector sel with the arguments pointed to by the va_list pointed to by ap. Return the result of the invocation.

Only the incoming arguments from *ap will be retrieved, so that subsequent va_arg invocations on *ap can retrieve the outgoing argument pointers.

This method is invoked by the runtime library in an attempt to forward a message not directly implemented by the receiver. This method is used since it is faster than a forwardInvocation.

boolean
  invocationp;
Return YES.

Performing the invocation

InvocationResult
  fire;
Perform the invocation. If invoked repeatedly, the invocation will be performed repeatedly.

void
  fire;
Similarly, but avoid the creation of an InvocationResult. The result of the receiving invocation is set to nil.

InvocationResult
  fireAt All target;
Perform the invocation after setting the receiver of this invocation to target.

void
  fireAt All target;
Similarly, but avoid the creation of an InvocationResult. The result of the receiving invocation is set to nil.

InvocationResult
  fireWith dynamic arguments;
Perform the invocation resulting from completing this invocation with the arguments. Return the result. The receiving invocation will remain incomplete.

void
  fireWith dynamic arguments;
Similarly, but avoid the creation of an InvocationResult. The result of the receiving invocation is set to nil.

_builtin_.Any
  objectAfterFire;
Shortcut to fire and return the first element of the result as an object.

_builtin_.Any
  objectOfResult;
Shortcut to retrieve the first element of the result as an object. This fires if needed.

InvocationResult
  result;
If the invocation has been fired at least once, return the (most recent) result. Otherwise, fire and return the result.

TypeDescription
  resultTypeDescription;
Return the type description of the result from this invocation.

void
  encodeUsingCoder Encoder coder;

Coding

void
  initWithCoder Decoder coder;
Undocumented.

protected void
  encodeToCoder Encoder coder;
Private method to do the hard work of encoding all information carried by this invocation.

protected void
  decodeFromCoder Decoder coder;
Private method to do the hard work of decoding all information from the coder into the invocation.

Garbage collection methods

void
  dealloc;
Deallocate the structure underlying the invocation.

void
  gc_mark_elements;
Mark the objects in this invocation's arguments.


Generated by tm 1.01.