Changeset 2577


Ignore:
Timestamp:
Oct 3, 2011, 3:53:55 PM (10 years ago)
Author:
Peter
Message:

closes #672

Location:
trunk/yat/omic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/omic/DNA.cc

    r2342 r2577  
    170170    return *this;
    171171  }
     172
     173
     174  DNA& DNA::operator=(char c)
     175  {
     176    init();
     177    std::map<char, unsigned short>::const_iterator i = char2code_.find(c);
     178    if (i==char2code_.end()) {
     179      std::string msg("DNA assignment from '");
     180      msg += c;
     181      msg += "'";
     182      throw std::invalid_argument(msg);
     183    }
     184    code_ = i->second;
     185    assert(code_<16);
     186    return *this;
     187  }
     188
    172189}}}
  • trunk/yat/omic/DNA.h

    r2385 r2577  
    55  $Id$
    66
    7   Copyright (C) 2010 Peter Johansson
     7  Copyright (C) 2010, 2011 Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    128128    DNA& operator^=(const DNA& rhs);
    129129
     130    /**
     131       \brief assign from a char
     132       
     133       \result resulting DNA
     134
     135       \since New in yat 0.8
     136     */
     137    DNA& operator=(char c);
     138
    130139  private:
    131140    unsigned short code_;
Note: See TracChangeset for help on using the changeset viewer.