EvolvingObjects
eoPeriodicContinue.h
00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
00002 
00003 // (c) OPAC Team, LIFL, Feb. 2006
00004 
00005 /* This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with this library; if not, write to the Free Software
00017    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00018 
00019    Contact: cahon@lifl.fr
00020 */
00021 
00022 #ifndef __eoPeriodicContinue_h
00023 #define __eoPeriodicContinue_h
00024 
00025 #include <eoContinue.h>
00026 #include <eoPop.h>
00027 
00030 template <class EOT> class eoPeriodicContinue: public eoContinue <EOT> {
00031 
00032 public:
00033 
00035   eoPeriodicContinue (unsigned __period, unsigned __init_counter = 0) :
00036       period (__period), counter (__init_counter)
00037     {}
00038 
00039 
00042   bool operator () (const eoPop <EOT> & /*pop*/)
00043   {
00044     return ((++ counter) % period) != 0 ;
00045   }
00046 
00047 
00048 private:
00049 
00050   unsigned period;
00051 
00052   unsigned counter;
00053 
00054 };
00055 #endif
 All Classes Namespaces Files Functions Variables Typedefs Friends