From: <ag...@us...> - 2011-10-17 13:11:20
|
Revision: 2567 http://zoolib.svn.sourceforge.net/zoolib/?rev=2567&view=rev Author: agreen Date: 2011-10-17 13:11:14 +0000 (Mon, 17 Oct 2011) Log Message: ----------- Add ZCogCombiner variants, for use with ZAccumulator_T. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZCog.h Modified: trunk/zoolib/source/cxx/zoolib/ZCog.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCog.h 2011-10-17 13:10:37 UTC (rev 2566) +++ trunk/zoolib/source/cxx/zoolib/ZCog.h 2011-10-17 13:11:14 UTC (rev 2567) @@ -293,6 +293,18 @@ const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >& iCallable1) { return ioCog0 = sCog_Either<Param>(ioCog0, iCallable1); } +template <class Param> +struct ZCogCombiner_Either + { + void operator()(ZCog<Param>& io0, const ZCog<Param>& i1) const + { + if (io0) + io0 = sCog_Either(io0, i1); + else + io0 = i1; + } + }; + // ================================================================================================= #pragma mark - #pragma mark * sCog_Both @@ -385,6 +397,18 @@ const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >& iCallable1) { return ioCog0 = sCog_Both<Param>(ioCog0, iCallable1); } +template <class Param> +struct ZCogCombiner_Both + { + void operator()(ZCog<Param>& io0, const ZCog<Param>& i1) const + { + if (io0) + io0 = sCog_Both(io0, i1); + else + io0 = i1; + } + }; + // ================================================================================================= #pragma mark - #pragma mark * sCog_Each @@ -465,6 +489,18 @@ const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >& iCallable1) { return ioCog0 = sCog_Each<Param>(ioCog0, iCallable1); } +template <class Param> +struct ZCogCombiner_Each + { + void operator()(ZCog<Param>& io0, const ZCog<Param>& i1) const + { + if (io0) + io0 = sCog_Each(io0, i1); + else + io0 = i1; + } + }; + // ================================================================================================= #pragma mark - #pragma mark * sCog_FollowedBy This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |