EvolvingObjects
eoCombinedContinue.h
00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
00002 
00003 //-----------------------------------------------------------------------------
00004 // eoCombinedContinue.h
00005 // (c) Maarten Keijzer, GeNeura Team, 1999, 2000
00006 /*
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 
00021     Contact: todos@geneura.ugr.es, http://geneura.ugr.es
00022 Authors :
00023     todos@geneura.ugr.es
00024     Marc Schoenauer
00025     Ramón Casero Cañas
00026     Johann Dréo
00027  */
00028 //-----------------------------------------------------------------------------
00029 
00030 #ifndef _eoCombinedContinue_h
00031 #define _eoCombinedContinue_h
00032 
00033 #include <eoContinue.h>
00034 
00047 template< class EOT>
00048 class eoCombinedContinue: public eoContinue<EOT>, public std::vector<eoContinue<EOT>* > {
00049 public:
00050 
00052   typedef typename EOT::Fitness FitnessType;
00053 
00055   eoCombinedContinue( eoContinue<EOT>& _cont)
00056     : eoContinue<EOT>(), std::vector<eoContinue<EOT>* >(1, &_cont) 
00057   {
00058   }
00059 
00060   /* FIXME remove in next release
00062   eoCombinedContinue( eoContinue<EOT>& _cont1, eoContinue<EOT>& _cont2)
00063     : eoContinue<EOT>(), std::vector<eoContinue<EOT>* >()
00064   {
00065 #ifndef DEPRECATED_MESSAGES
00066 #pragma message "The double continuators constructor of eocombinedContinue is deprecated and will be removed in the next release."
00067 #endif // !DEPRECATED_MESSAGES
00068 
00069     this->push_back(&_cont1);
00070     this->push_back(&_cont2);
00071   }
00072   */
00073 
00074   void add(eoContinue<EOT> & _cont)
00075   {
00076     this->push_back(&_cont);
00077   }
00078 
00079   /* FIXME remove in next release
00080   void removeLast(void)
00081   {
00082 #ifndef DEPRECATED_MESSAGES
00083 #pragma message "The removeLast method of eocombinedContinue is deprecated and will be removed in the next release, use pop_back instead."
00084 #endif // !DEPRECATED_MESSAGES
00085 
00086     this->pop_back();
00087   }
00088   */
00089 
00090 
00093   virtual bool operator() ( const eoPop<EOT>& _pop )
00094   {
00095     for (unsigned i = 0; i < this->size(); ++i)
00096       if ( ! (*this->at(i))(_pop) ) return false;
00097     return true;
00098   }
00099 
00100   virtual std::string className(void) const { return "eoCombinedContinue"; }
00101 
00102 //private:
00103 //  std::vector<eoContinue<EOT>*>    continuators;
00104 };
00105 
00106 #endif
 All Classes Namespaces Files Functions Variables Typedefs Friends