ObjectiveLib  1.0.0
Public Member Functions | Static Public Member Functions | Protected Attributes
OLMemFun Class Reference

A function object that sends a given message to a given object and returns the result. More...

#import <ObjectiveLib/Functional.h>

Inheritance diagram for OLMemFun:
Inheritance graph
[legend]

List of all members.

Public Member Functions

(void) - encodeWithCoder:
 Encode the function object.
(id) - performUnaryFunctionWithArg:
 Send the stored message to the object referenced by arg.
(void) - writeSelfToStream:
Initializers and Deallocators
(id) - initWithCoder:
(id) - initWithObjectInStream:
(id) - initWithSelector:
 Initialize the function object with the given selector.

Static Public Member Functions

(id) + functorWithSelector:
 Create and return an instance of OLMemFun.

Protected Attributes

SEL sel
 The selector to perform.

Detailed Description

A function object that sends a given message to a given object and returns the result.

The selector is stored in the function object and then is invoked by the function object using the given argument as the object to which to send the message.

See also:
OLMemFun1

Member Function Documentation

- (void) encodeWithCoder: (NSCoder *)  encoder

Encode the function object.

The function object is saved to an archive using encoder. The function object will be retrieved from the archive using the initializer #initWithCoder:.

Parameters:
encoderthe coder which will save the function object to the archive

Reimplemented from OLStreamableFunctor.

+ (id) functorWithSelector: (SEL)  selector

Create and return an instance of OLMemFun.

Note:
If OpenStep is present the returned object will be autoreleased before being returned.
Parameters:
selectorthe selector to store for future invocation
Returns:
a new functor
- (id) initWithSelector: (SEL)  selector

Initialize the function object with the given selector.

Parameters:
selectorthe selector to store for future invocation
Returns:
a reference to this function object
- (id) performUnaryFunctionWithArg: (id)  arg

Send the stored message to the object referenced by arg.

The object returned may or may not be owned by the sender of the message, depending on the nature of the message being sent. No attempt is made by the function object to control memory management of the returned object.

Precondition:
arg must respond to the selector passed to the initializer.
Parameters:
argthe object to which to send the message
Returns:
the result of invoking the message. Note that memory management is not controlled by the function object and the question of whether to deallocate the returned object depends on the nature of the message.

Reimplemented from <OLUnaryFunction>.


Member Data Documentation

- (SEL) sel [protected]

The selector to perform.


The documentation for this class was generated from the following file:

ObjectiveLibGenerated Sat Feb 15 2014 07:45:34, © 2004-2007 Will Mason