OpenStructure
chem_class.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_BASE_CHEM_CLASS_HI
20 #define OST_BASE_CHEM_CLASS_HI
21 
22 #include <ost/mol/module_config.hh>
23 
24 
25 namespace ost { namespace mol {
26 
27 struct DLLEXPORT ChemClass {
28  const static char PeptideLinking ='P';
29  const static char DPeptideLinking ='D';
30  const static char LPeptideLinking ='L';
31  const static char RNALinking ='R';
32  const static char DNALinking ='S';
33  const static char NonPolymer ='N';
34  const static char LSaccharide ='X';
35  const static char DSaccharide ='Y';
36  const static char Saccharide ='Z';
37  const static char Water ='W';
38  const static char Unknown ='U';
39  explicit ChemClass(char chem_class)
40  : chem_class_(chem_class) {
41  }
42 
44  : chem_class_(Unknown) {
45  }
46  bool operator==(const ChemClass& cc) const {
47  return cc.chem_class_==chem_class_;
48  }
49 
50  bool operator!=(const ChemClass& cc) const {
51  return !this->operator==(cc);
52  }
53 
54  bool IsPeptideLinking() const {
55  return (chem_class_==ChemClass::PeptideLinking ||
56  chem_class_==ChemClass::DPeptideLinking ||
57  chem_class_==ChemClass::LPeptideLinking);
58  }
59  bool IsNucleotideLinking() const {
60  return (chem_class_==ChemClass::DNALinking ||
61  chem_class_==ChemClass::RNALinking);
62  }
63 
64  bool IsWater() const { return chem_class_==ChemClass::Water; }
65  operator char() const {
66  return chem_class_;
67  }
68 private:
69  char chem_class_;
70 };
71 
72 }} // ns
73 #endif