OLBinder1st Class Reference
[Function Objects]

Transform a binary function object into a unary function object. More...

#import <ObjectiveLib/Functional.h>

Inheritance diagram for OLBinder1st:

Inheritance graph
[legend]
List of all members.

Public Member Functions

(id) - performUnaryFunctionWithArg:
 Perform the function of this function object.
(void) - writeSelfToStream:
 Write the object to a stream.
Initializers and Deallocators
(id) - free
(id) - initWithFunction:andLeftArg:
 Initialize the function object.
(id) - initWithObjectInStream:
 Initialize the object.

Static Public Member Functions

(id) + functorWithFunction:andLeftArg:
 Create and return an instance of OLBinder1st.

Protected Attributes

OLStreamableFunctor< OLBinaryFunction > * fn
 The function to which to bind an argument.
id lft
 The argument to bind.

Detailed Description

Transform a binary function object into a unary function object.

This function object binds a given object to the first argument of a given binary function object, thus producing a unary function object.


Member Function Documentation

+ (id) functorWithFunction: (OLStreamableFunctor< OLBinaryFunction > *)  function
andLeftArg: (id)  left 

Create and return an instance of OLBinder1st.

Note:
If OpenStep is present the returned object will be autoreleased before being returned.
Parameters:
function the binary function object to use
left the left or first argument for the binary function object
Returns:
a new functor

- (id) initWithFunction: (OLStreamableFunctor< OLBinaryFunction > *)  function
andLeftArg: (id)  left 

Initialize the function object.

The binary function object and its first argument are stored for later use. When this function object's performUnaryFunctionWithArg: message is sent the argument to the message becomes the second argument to the underlying binary function object and its result is returned. The first argument to the underlying binary function object will be left.

Note:
If archiving or serializing the function object is desired, the argument left must conform to the NSCoding protocol.
Parameters:
function the binary function object to use
left the left or first argument for the binary function object
Returns:
a reference to this function object

- (id) initWithObjectInStream: (OLObjectInStream *)  stream  

Initialize the object.

Each instance variable is read from stream and all other initialization is performed.

Parameters:
stream the stream from which to read
Returns:
a reference to this object

Reimplemented from OLStreamableFunctor.

- (id) performUnaryFunctionWithArg: (id)  arg  

Perform the function of this function object.

Specifically, the underlying binary function object passed to initWithFunction:andLeftArg: is called with the stored object as the first argument and arg as the second argument. The result of the binary function is then returned.

Parameters:
arg the argument to the function
Returns:
a new object containing the result

Reimplemented from < OLUnaryFunction >.

- (void) writeSelfToStream: (OLObjectOutStream *)  stream  

Write the object to a stream.

All instance variables are written to stream.

Parameters:
stream the stream to which to write.

Reimplemented from OLStreamableFunctor.


Member Data Documentation

- (OLStreamableFunctor<OLBinaryFunction>*) fn [protected]

The function to which to bind an argument.

- (id) lft [protected]

The argument to bind.


The documentation for this class was generated from the following file:
ObjectiveLibGenerated Sun Apr 22 15:18:13 2007, © 2004-2007 Will Mason
SourceForge.net Logo