OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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_HH
20 #define OST_BASE_CHEM_CLASS_HH
21 
22 #include <ost/mol/module_config.hh>
23 
24 
25 namespace ost { namespace mol {
26 
27 struct DLLEXPORT ChemClass {
28 
29  const static char PEPTIDE_LINKING ='P';
30  const static char D_PEPTIDE_LINKING ='D';
31  const static char L_PEPTIDE_LINKING ='L';
32  const static char RNA_LINKING ='R';
33  const static char DNA_LINKING ='S';
34  const static char NON_POLYMER ='N';
35  const static char L_SACCHARIDE ='X';
36  const static char D_SACCHARIDE ='Y';
37  const static char SACCHARIDE ='Z';
38  const static char WATER ='W';
39  const static char UNKNOWN ='U';
40 
41  // for backward compatibility to 1.1 and earlier
42  const static char PeptideLinking =PEPTIDE_LINKING;
43  const static char DPeptideLinking =D_PEPTIDE_LINKING;
44  const static char LPeptideLinking =L_PEPTIDE_LINKING;
45  const static char RNALinking =RNA_LINKING;
46  const static char DNALinking =DNA_LINKING;
47  const static char NonPolymer =NON_POLYMER;
48  const static char LSaccharide =L_SACCHARIDE;
49  const static char DSaccharide =D_SACCHARIDE;
50  const static char Saccharide =SACCHARIDE;
51  const static char Water =WATER;
52  const static char Unknown =UNKNOWN;
53  explicit ChemClass(char chem_class)
54  : chem_class_(chem_class) {
55  }
56 
58  : chem_class_(UNKNOWN) {
59  }
60  bool operator==(const ChemClass& cc) const {
61  return cc.chem_class_==chem_class_;
62  }
63 
64  bool operator!=(const ChemClass& cc) const {
65  return !this->operator==(cc);
66  }
67 
68  bool IsPeptideLinking() const {
69  return (chem_class_==ChemClass::PEPTIDE_LINKING ||
70  chem_class_==ChemClass::D_PEPTIDE_LINKING ||
71  chem_class_==ChemClass::L_PEPTIDE_LINKING);
72  }
73  bool IsNucleotideLinking() const {
74  return (chem_class_==ChemClass::DNA_LINKING ||
75  chem_class_==ChemClass::RNA_LINKING);
76  }
77 
78  bool IsWater() const { return chem_class_==ChemClass::WATER; }
79  operator char() const {
80  return chem_class_;
81  }
82 private:
83  char chem_class_;
84 };
85 
86 }} // ns
87 #endif