OLBinder2nd Class Reference
[Function Objects]

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

#import <ObjectiveLib/Functional.h>

Inheritance diagram for OLBinder2nd:

Inheritance graph
[legend]
List of all members.

Public Member Functions

(void) - encodeWithCoder:
 Encode the function object.
(id) - performUnaryFunctionWithArg:
 Perform the function of this function object.
(void) - writeSelfToStream:
 Write the object to a stream.
Initializers and Deallocators
(void) - dealloc
(id) - initWithCoder:
 Initialize the function object.
(id) - initWithFunction:andRightArg:
 Initialize the function object.
(id) - initWithObjectInStream:
 Initialize the object.

Static Public Member Functions

(id) + functorWithFunction:andRightArg:
 Create and return an instance of OLBinder2nd.

Protected Attributes

OLStreamableFunctor< OLBinaryFunction > * fn
 The function to which to bind an argument.
id rght
 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 second argument of a given binary function object, thus producing a unary function object.


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:
encoder the coder which will save the function object to the archive

Reimplemented from OLStreamableFunctor.

+ (id) functorWithFunction: (OLStreamableFunctor< OLBinaryFunction > *)  function
andRightArg: (id)  right 

Create and return an instance of OLBinder2nd.

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

- (id) initWithCoder: (NSCoder *)  decoder  

Initialize the function object.

This initializer creates a new function object from an archive and returns it.

Postcondition:
The function object returned will be identical to the function object saved to the archive using the encodeWithCoder: message.
Parameters:
decoder the coder which will decode the archived function object
Returns:
a reference to this function object

Reimplemented from OLStreamableFunctor.

- (id) initWithFunction: (OLStreamableFunctor< OLBinaryFunction > *)  function
andRightArg: (id)  right 

Initialize the function object.

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

Note:
If archiving or serializing the function object is desired, the argument right must conform to the NSCoding protocol.
Parameters:
function the binary function object to use
right the right or second 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:andRightArg: is called with arg as the first argument and the stored object 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) rght [protected]

The argument to bind.


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