00001 /***************************************************************************** 00002 * Copyright (C) 2011 by Benjamin Hadorn (b_hadorn@bluewin.ch) 00003 ***************************************************************************** 00004 * Project : Zeus Math Library 00005 * Module : GAGene 00006 * Package : Zeus.ZeusMath.Intel 00007 * Author : Benjamin Hadorn 00008 * Date : 27.12.2011 00009 * System : Zeus-Framework 00010 ***************************************************************************** 00011 * Licence: * 00012 * This library is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU Lesser General Public License as * 00014 * published by the Free Software Foundation; either version * 00015 * 2.1 of the License, or (at your option) any later version. * 00016 * * 00017 * This library is distributed in the hope that it will be useful, * 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00020 * GNU Lesser General Public License for more details. * 00021 * * 00022 * You should have received a copy of the GNU Lesser General Public * 00023 * License along with this library; if not, write to the Free Software * 00024 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA * 00025 *****************************************************************************/ 00026 00027 /***************************************************************************** 00028 * Changes: 00029 * 27.12.2011 bha: created zeus 2.0 00030 *****************************************************************************/ 00031 00032 #ifndef GAGeneH 00033 #define GAGeneH 00034 00035 #include <zeusmath/Intel/Interfaces/IGAGene.hpp> 00036 #include <zeusbase/System/ByteArray.hpp> 00037 00038 BEGIN_NAMESPACE_Zeus 00039 00040 /**************************************************************************/ 00043 /**************************************************************************/ 00044 zeusmath_class TGAGene : public IGAGene 00045 { 00046 public: 00047 TGAGene(TByteArray& rDNA, Int iStart, Int iEnd); 00048 inline virtual ~TGAGene() {} 00049 00050 //Methods of IGAGene 00051 virtual Retval MQUALIFIER copyGeneToDNA(const IGAGene& rGene); 00052 virtual IByteArray& MQUALIFIER getDNA(); 00053 virtual const IByteArray& MQUALIFIER getDNAConst() const; 00054 virtual Int MQUALIFIER getEndByteIndex() const; 00055 virtual Int MQUALIFIER getStartByteIndex() const; 00056 virtual Int8 MQUALIFIER getInt8() const; 00057 virtual Int16 MQUALIFIER getInt16() const; 00058 virtual Int32 MQUALIFIER getInt32() const; 00059 virtual Int64 MQUALIFIER getInt64() const; 00060 virtual Float32 MQUALIFIER getFloat32() const; 00061 virtual Float64 MQUALIFIER getFloat64() const; 00062 virtual void MQUALIFIER setInt8(const Int8& rValue); 00063 virtual void MQUALIFIER setInt16(const Int16& rValue); 00064 virtual void MQUALIFIER setInt32(const Int32& rValue); 00065 virtual void MQUALIFIER setInt64(const Int64& rValue); 00066 virtual void MQUALIFIER setFloat32(const Float32& rValue); 00067 virtual void MQUALIFIER setFloat64(const Float64& rValue); 00068 virtual void MQUALIFIER mutate(); 00069 00070 protected: 00071 Int getSize() const; 00072 00074 TByteArray& m_rDNA; 00076 Int m_iStart; 00078 Int m_iEnd; 00079 00080 private: 00081 }; 00082 00083 /**************************************************************************/ 00086 /**************************************************************************/ 00087 inline IByteArray& MQUALIFIER TGAGene::getDNA() 00088 { 00089 return m_rDNA; 00090 } 00091 00092 /**************************************************************************/ 00095 /**************************************************************************/ 00096 inline const IByteArray& MQUALIFIER TGAGene::getDNAConst() const 00097 { 00098 return m_rDNA; 00099 } 00100 00101 /**************************************************************************/ 00104 /**************************************************************************/ 00105 inline Int MQUALIFIER TGAGene::getEndByteIndex() const 00106 { 00107 return m_iEnd; 00108 } 00109 00110 /**************************************************************************/ 00113 /**************************************************************************/ 00114 inline Int MQUALIFIER TGAGene::getStartByteIndex() const 00115 { 00116 return m_iStart; 00117 } 00118 00119 /**************************************************************************/ 00122 /**************************************************************************/ 00123 inline Int TGAGene::getSize() const 00124 { 00125 return m_iEnd - m_iStart + 1; 00126 } 00127 00128 00129 END_NAMESPACE_Zeus 00130 00131 #endif