From: <ag...@us...> - 2011-07-28 20:29:24
|
Revision: 2434 http://zoolib.svn.sourceforge.net/zoolib/?rev=2434&view=rev Author: agreen Date: 2011-07-28 20:29:18 +0000 (Thu, 28 Jul 2011) Log Message: ----------- Add sOnce. Some cleanup. 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-07-28 20:28:16 UTC (rev 2433) +++ trunk/zoolib/source/cxx/zoolib/ZCog.h 2011-07-28 20:29:18 UTC (rev 2434) @@ -61,25 +61,25 @@ //-- - ZCog(const inherited& iOther) - : inherited(iOther) + ZCog(Callable* iCallable) + : inherited(iCallable) {} - - ZCog& operator=(const inherited& iOther) + + ZCog& operator=(Callable* iCallable) { - inherited::operator=(iOther); + inherited::operator=(iCallable); return *this; } //-- - ZCog(Callable* iCallable) - : inherited(iCallable) + ZCog(const ZRef<Callable>& iOther) + : inherited(iOther) {} - - ZCog& operator=(Callable* iCallable) + + ZCog& operator=(const ZRef<Callable>& iOther) { - inherited::operator=(iCallable); + inherited::operator=(iOther); return *this; } @@ -262,6 +262,23 @@ // ================================================================================================= #pragma mark - +#pragma mark * sOnce + +template <class Param> +ZCog<Param> sOnce_Fun(const ZCog<Param>& iSelf, Param iParam, + ZCog<Param> iCog) + { + if (iCog) + iCog->Call(iCog, iParam); + return null; + } + +template <class Param> +ZCog<Param> sOnce(ZCog<Param> iCog) + { return sBindR(sCallable(sOnce_Fun<Param>), iCog); } + +// ================================================================================================= +#pragma mark - #pragma mark * sRepeat template <class Param> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |