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

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

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

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

- (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) 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:
functionthe binary function object to use
leftthe 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:
functionthe binary function object to use
leftthe left or first argument for the binary function object
Returns:
a reference to this function object
- (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:
argthe argument to the function
Returns:
a new object containing the result

Reimplemented from <OLUnaryFunction>.


Member Data Documentation

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 Sat Feb 15 2014 07:45:34, © 2004-2007 Will Mason