00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #if !defined(FUNCTIONAL_OL_GUARD)
00044 #define FUNCTIONAL_OL_GUARD
00045
00046 #include <ObjectiveLib/ObjectBase.h>
00047 #include <ObjectiveLib/Types.h>
00048
00070 @protocol OLBinaryFunction
00071
00081 - (id) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
00082
00083 @end
00084
00093 @protocol OLUnaryFunction
00094
00103 - (id) performUnaryFunctionWithArg: (id)arg;
00104
00105 @end
00106
00117 @protocol OLBoolBinaryFunction
00118
00127 - (BOOL) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
00128
00129 @end
00130
00141 @protocol OLBoolUnaryFunction
00142
00150 - (BOOL) performUnaryFunctionWithArg: (id)arg;
00151
00152 @end
00153
00163 @interface OLFunctor :
00164 #if defined(OL_NO_OPENSTEP)
00165 Object
00166 #else
00167 NSObject
00168 #endif
00169 {
00170 }
00171
00183 + (id) functorOfType: (OLFunctorType)type;
00184
00185 @end
00186
00199 @interface OLStreamableFunctor : OLFunctor
00200 #if defined(OL_NO_OPENSTEP)
00201 <OLStreamable>
00202 #else
00203 <OLStreamable, NSCoding>
00204 #endif
00205 {
00206 }
00207
00208 #if !defined(OL_NO_OPENSTEP)
00209
00219 - (id) initWithCoder: (NSCoder*)decoder;
00220 #endif
00221
00222 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00223
00224 #if !defined(OL_NO_OPENSTEP)
00225
00232 - (void) encodeWithCoder: (NSCoder*)encoder;
00233 #endif
00234
00235 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
00236
00237 @end
00238
00248 @interface OLBinaryNegate : OLStreamableFunctor <OLBoolBinaryFunction>
00249 {
00250 @protected
00254 OLStreamableFunctor<OLBoolBinaryFunction>* fn;
00255 }
00256
00268 + (id) functorWithBinaryFunction: (OLStreamableFunctor<OLBoolBinaryFunction>*)function;
00269
00273
00274 #if !defined(OL_NO_OPENSTEP)
00275 - (id) initWithCoder: (NSCoder*)decoder;
00276 #endif
00277
00284 - (id) initWithBinaryFunction: (OLStreamableFunctor<OLBoolBinaryFunction>*)function;
00285
00286 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00287
00291 #if defined(OL_NO_OPENSTEP)
00292 - (id) free;
00293 #else
00294 - (void) dealloc;
00295 #endif
00296
00297
00298 #if !defined(OL_NO_OPENSTEP)
00299 - (void) encodeWithCoder: (NSCoder*)encoder;
00300 #endif
00301
00309 - (BOOL) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
00310
00311 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
00312
00313 @end
00314
00324 @interface OLBinder1st : OLStreamableFunctor <OLUnaryFunction>
00325 {
00326 @protected
00330 OLStreamableFunctor<OLBinaryFunction>* fn;
00331
00335 id lft;
00336 }
00337
00348 + (id) functorWithFunction: (OLStreamableFunctor<OLBinaryFunction>*)function andLeftArg: (id)left;
00349
00353
00354 #if !defined(OL_NO_OPENSTEP)
00355 - (id) initWithCoder: (NSCoder*)decoder;
00356 #endif
00357
00372 - (id) initWithFunction: (OLStreamableFunctor<OLBinaryFunction>*)function andLeftArg: (id)left;
00373 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00374 #if defined(OL_NO_OPENSTEP)
00375 - (id) free;
00376 #else
00377 - (void) dealloc;
00378 #endif
00379
00380
00381 #if !defined(OL_NO_OPENSTEP)
00382 - (void) encodeWithCoder: (NSCoder*)encoder;
00383 #endif
00384
00394 - (id) performUnaryFunctionWithArg: (id)arg;
00395
00396 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
00397
00398 @end
00399
00409 @interface OLBinder2nd : OLStreamableFunctor <OLUnaryFunction>
00410 {
00411 @protected
00415 OLStreamableFunctor<OLBinaryFunction>* fn;
00416
00420 id rght;
00421 }
00422
00433 + (id) functorWithFunction: (OLStreamableFunctor<OLBinaryFunction>*)function andRightArg: (id)right;
00434
00438
00439 #if !defined(OL_NO_OPENSTEP)
00440 - (id) initWithCoder: (NSCoder*)decoder;
00441 #endif
00442
00457 - (id) initWithFunction: (OLStreamableFunctor<OLBinaryFunction>*)function andRightArg: (id)right;
00458 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00459 #if defined(OL_NO_OPENSTEP)
00460 - (id) free;
00461 #else
00462 - (void) dealloc;
00463 #endif
00464
00465
00466 #if !defined(OL_NO_OPENSTEP)
00467 - (void) encodeWithCoder: (NSCoder*)encoder;
00468 #endif
00469
00479 - (id) performUnaryFunctionWithArg: (id)arg;
00480
00481 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
00482
00483 @end
00484
00494 @interface OLBoolBinder1st : OLStreamableFunctor <OLBoolUnaryFunction>
00495 {
00496 @protected
00500 OLStreamableFunctor<OLBoolBinaryFunction>* fn;
00501
00505 id lft;
00506 }
00507
00518 + (id) functorWithBoolFunction: (OLStreamableFunctor<OLBoolBinaryFunction>*)function andLeftArg: (id)left;
00519
00523
00535 - (id) initWithBoolFunction: (OLStreamableFunctor<OLBoolBinaryFunction>*)function andLeftArg: (id)left;
00536 #if !defined(OL_NO_OPENSTEP)
00537 - (id) initWithCoder: (NSCoder*)decoder;
00538 #endif
00539 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00540 #if defined(OL_NO_OPENSTEP)
00541 - (id) free;
00542 #else
00543 - (void) dealloc;
00544 #endif
00545
00546
00547 #if !defined(OL_NO_OPENSTEP)
00548 - (void) encodeWithCoder: (NSCoder*)encoder;
00549 #endif
00550
00560 - (BOOL) performUnaryFunctionWithArg: (id)arg;
00561
00562 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
00563
00564 @end
00565
00575 @interface OLBoolBinder2nd : OLStreamableFunctor <OLBoolUnaryFunction>
00576 {
00577 @protected
00581 OLStreamableFunctor<OLBoolBinaryFunction>* fn;
00582
00586 id rght;
00587 }
00588
00599 + (id) functorWithBoolFunction: (OLStreamableFunctor<OLBoolBinaryFunction>*)function andRightArg: (id)right;
00600
00604
00616 - (id) initWithBoolFunction: (OLStreamableFunctor<OLBoolBinaryFunction>*)function andRightArg: (id)right;
00617 #if !defined(OL_NO_OPENSTEP)
00618 - (id) initWithCoder: (NSCoder*)decoder;
00619 #endif
00620 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00621 #if defined(OL_NO_OPENSTEP)
00622 - (id) free;
00623 #else
00624 - (void) dealloc;
00625 #endif
00626
00627
00628 #if !defined(OL_NO_OPENSTEP)
00629 - (void) encodeWithCoder: (NSCoder*)encoder;
00630 #endif
00631
00641 - (BOOL) performUnaryFunctionWithArg: (id)arg;
00642
00643 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
00644
00645 @end
00646
00655 @interface OLDivides : OLStreamableFunctor <OLBinaryFunction>
00656 {
00657 }
00658
00669 - (id) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
00670
00671 @end
00672
00681 @interface OLEqualTo : OLStreamableFunctor <OLBoolBinaryFunction>
00682 {
00683 }
00684
00694 - (BOOL) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
00695
00696 @end
00697
00706 @interface OLGreater : OLStreamableFunctor <OLBoolBinaryFunction>
00707 {
00708 }
00709
00719 - (BOOL) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
00720
00721 @end
00722
00731 @interface OLGreaterEqual : OLStreamableFunctor <OLBoolBinaryFunction>
00732 {
00733 }
00734
00744 - (BOOL) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
00745
00746 @end
00747
00756 @interface OLLess : OLStreamableFunctor <OLBoolBinaryFunction>
00757 {
00758 }
00759
00769 - (BOOL) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
00770
00771 @end
00772
00781 @interface OLLessEqual : OLStreamableFunctor <OLBoolBinaryFunction>
00782 {
00783 }
00784
00794 - (BOOL) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
00795
00796 @end
00797
00807 @interface OLLogicalAnd : OLStreamableFunctor <OLBoolBinaryFunction>
00808 {
00809 }
00810
00822 - (BOOL) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
00823
00824 @end
00825
00835 @interface OLLogicalNot : OLStreamableFunctor <OLBoolUnaryFunction>
00836 {
00837 }
00838
00847 - (BOOL) performUnaryFunctionWithArg: (id)arg;
00848
00849 @end
00850
00860 @interface OLLogicalOr : OLStreamableFunctor <OLBoolBinaryFunction>
00861 {
00862 }
00863
00875 - (BOOL) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
00876
00877 @end
00878
00891 @interface OLMemFun : OLStreamableFunctor <OLUnaryFunction>
00892 {
00893 @protected
00897 SEL sel;
00898 }
00899
00909 + (id) functorWithSelector: (SEL)selector;
00910
00914
00915 #if !defined(OL_NO_OPENSTEP)
00916 - (id) initWithCoder: (NSCoder*)decoder;
00917 #endif
00918
00919 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00920
00927 - (id) initWithSelector: (SEL)selector;
00928
00929
00930 #if !defined(OL_NO_OPENSTEP)
00931 - (void) encodeWithCoder: (NSCoder*)encoder;
00932 #endif
00933
00947 - (id) performUnaryFunctionWithArg: (id)arg;
00948
00949 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
00950
00951 @end
00952
00965 @interface OLMemFun1 : OLStreamableFunctor <OLBinaryFunction>
00966 {
00967 @protected
00971 SEL sel;
00972 }
00973
00983 + (id) functorWithSelector: (SEL)selector;
00984
00988
00989 #if !defined(OL_NO_OPENSTEP)
00990 - (id) initWithCoder: (NSCoder*)decoder;
00991 #endif
00992
00993 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00994
01001 - (id) initWithSelector: (SEL)selector;
01002
01003
01004 #if !defined(OL_NO_OPENSTEP)
01005 - (void) encodeWithCoder: (NSCoder*)encoder;
01006 #endif
01007
01023 - (id) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
01024
01025 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
01026
01027 @end
01028
01037 @interface OLMinus : OLStreamableFunctor <OLBinaryFunction>
01038 {
01039 }
01040
01051 - (id) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
01052
01053 @end
01054
01063 @interface OLModulus : OLStreamableFunctor <OLBinaryFunction>
01064 {
01065 }
01066
01078 - (id) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
01079
01080 @end
01081
01090 @interface OLMultiplies : OLStreamableFunctor <OLBinaryFunction>
01091 {
01092 }
01093
01104 - (id) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
01105
01106 @end
01107
01116 @interface OLNegate : OLStreamableFunctor <OLUnaryFunction>
01117 {
01118 }
01119
01129 - (id) performUnaryFunctionWithArg: (id)arg;
01130
01131 @end
01132
01141 @interface OLNotEqualTo : OLStreamableFunctor <OLBoolBinaryFunction>
01142 {
01143 }
01144
01154 - (BOOL) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
01155
01156 @end
01157
01165 @interface OLPlus : OLStreamableFunctor <OLBinaryFunction>
01166 {
01167 }
01168
01179 - (id) performBinaryFunctionWithArg: (id)arg1 andArg: (id)arg2;
01180
01181 @end
01182
01192 @interface OLUnaryNegate : OLStreamableFunctor <OLBoolUnaryFunction>
01193 {
01194 @protected
01198 OLStreamableFunctor<OLBoolUnaryFunction>* fn;
01199 }
01200
01210 + (id) functorWithUnaryFunction: (OLStreamableFunctor<OLBoolUnaryFunction>*)function;
01211
01215
01216 #if !defined(OL_NO_OPENSTEP)
01217 - (id) initWithCoder: (NSCoder*)decoder;
01218 #endif
01219
01220 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
01221
01228 - (id) initWithUnaryFunction: (OLStreamableFunctor<OLBoolUnaryFunction>*)function;
01229
01233 #if defined(OL_NO_OPENSTEP)
01234 - (id) free;
01235 #else
01236 - (void) dealloc;
01237 #endif
01238
01239
01240 #if !defined(OL_NO_OPENSTEP)
01241 - (void) encodeWithCoder: (NSCoder*)encoder;
01242 #endif
01243
01250 - (BOOL) performUnaryFunctionWithArg: (id)arg;
01251
01252 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
01253
01254 @end
01255
01256 #endif