00001 /* 00002 * Copyright (C) 2005 Maarten Keijzer 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of version 2 of the GNU General Public License as 00006 * published by the Free Software Foundation. 00007 * 00008 * This program is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 * GNU General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU General Public License 00014 * along with this program; if not, write to the Free Software 00015 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 */ 00017 00018 #ifndef SYMLAMBDAMUTATE_H 00019 #define SYMLAMBDAMUTATE_H 00020 00021 #include <eoOp.h> 00022 00023 class NodeSelector; 00024 class Sym; 00025 extern Sym compress(Sym, NodeSelector&); 00026 extern Sym expand(Sym, NodeSelector&); 00027 00028 00029 template <class EoType> 00030 class eoSymLambdaMutate : public eoMonOp<EoType> { 00031 NodeSelector& selector; 00032 public : 00033 eoSymLambdaMutate(NodeSelector& s) : selector(s) {} 00034 00035 bool operator()(EoType& tomutate) { 00036 if (rng.flip()) { 00037 tomutate.set( expand(tomutate, selector)); 00038 } else { 00039 tomutate.set( compress(tomutate, selector)); 00040 } 00041 return true; 00042 } 00043 00044 }; 00045 00046 00047 #endif
1.4.7