# 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
    00041 template <class fitnessT >
    00042 class eoString: public EO<fitnessT>, public std::string
    00043 {
    00044 public:
    00045
    00046     typedef char Type;
    00047     typedef char AtomType;
    00048     typedef std::string   ContainerType;
    00049
    00050
    00052
    00053
    00054   eoString( const std::string& _str ="" )
    00055     : std::string( _str ) {};
    00056
    00058   virtual void printOn(std::ostream& os) const
    00059   {
    00060     EO<fitnessT>::printOn(os);
    00061     os << ' ';
    00062
    00063     os << size() << ' ' << substr() << std::endl;
    00064
    00065   }
    00066
    00074   virtual std::string className() const {return "eoString";};
    00076
    00077
    00078 };
    00079
    00080 #endif
    00081