EvolvingObjects
eoString.h
00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
00002 
00003 //-----------------------------------------------------------------------------
00004 // eoString.h
00005 // (c) GeNeura Team, 1998
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  */
00023 //-----------------------------------------------------------------------------
00024 
00025 #ifndef _eoString_H
00026 #define _eoString_H
00027 
00028 // STL libraries
00029 #include <iostream>
00030 #include <string>
00031 #include <stdexcept>
00032 
00033 
00034 #include <EO.h>
00035 
00036 //-----------------------------------------------------------------------------
00037 // eoString
00038 //-----------------------------------------------------------------------------
00039 
00045 template <class fitnessT >
00046 class eoString: public EO<fitnessT>, public std::string
00047 {
00048 public:
00049 
00050     typedef char Type;
00051     typedef char AtomType;
00052     typedef std::string   ContainerType;
00053 
00054 
00056 
00057 
00058   eoString( const std::string& _str ="" )
00059     : std::string( _str ) {};
00060 
00062   virtual void printOn(std::ostream& os) const
00063   {
00064     EO<fitnessT>::printOn(os);
00065     os << ' ';
00066 
00067     os << size() << ' ' << substr() << std::endl;
00068 
00069   }
00070 
00078   virtual std::string className() const {return "eoString";};
00080 
00081 
00082 };
00083 
00084 #endif
 All Classes Namespaces Files Functions Variables Typedefs Friends