yat  0.8.3pre
DNA.h
00001 #ifndef theplu_yat_omic_dna
00002 #define theplu_yat_omic_dna
00003 
00004 /*
00005   $Id: DNA.h 2577 2011-10-03 13:53:55Z peter $
00006 
00007   Copyright (C) 2010, 2011 Peter Johansson
00008 
00009   This file is part of the yat library, http://dev.thep.lu.se/yat
00010 
00011   The yat library is free software; you can redistribute it and/or
00012   modify it under the terms of the GNU General Public License as
00013   published by the Free Software Foundation; either version 3 of the
00014   License, or (at your option) any later version.
00015 
00016   The yat library is distributed in the hope that it will be useful,
00017   but WITHOUT ANY WARRANTY; without even the implied warranty of
00018   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00019   General Public License for more details.
00020 
00021   You should have received a copy of the GNU General Public License
00022   along with yat. If not, see <http://www.gnu.org/licenses/>.
00023 */
00024 
00025 #include <boost/operators.hpp>
00026 
00027 #include <iosfwd>
00028 #include <map>
00029 #include <string>
00030 #include <vector>
00031 
00032 namespace theplu {
00033 namespace yat {
00034 namespace omic {
00035 
00062   class DNA : boost::operators<DNA>
00063   {
00064   public:
00070     DNA(void);
00071 
00075     DNA(const DNA&);
00076 
00084     explicit DNA(char c);
00085 
00093     DNA complement(void) const;
00094 
00098     char get(void) const;
00099 
00108     DNA& operator&=(const DNA& rhs);
00109 
00118     DNA& operator|=(const DNA& rhs);
00119 
00128     DNA& operator^=(const DNA& rhs);
00129 
00137     DNA& operator=(char c);
00138 
00139   private:
00140     unsigned short code_;
00141     static std::map<char, unsigned short> char2code_;
00142     static std::vector<char> code2char_;
00143 
00144     void init(void) const;
00145 
00146     friend bool operator==(const DNA&, const DNA&);
00147 };  
00148 
00156   std::string expand(const DNA&);
00157 
00169   bool operator==(const DNA& lhs, const DNA& rhs);
00170 
00178   std::ostream& operator<<(std::ostream& os, const DNA& dna);
00179 }}}
00180 #endif

Generated on Thu Dec 20 2012 03:12:57 for yat by  doxygen 1.8.0-20120409