OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
chem_type.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-2010 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_TYPE_HI
20 #define OST_BASE_CHEM_TYPE_HI
21 #include <vector>
22 
23 #include <boost/shared_ptr.hpp>
24 
25 #include <ost/mol/module_config.hh>
26 
27 
28 namespace ost { namespace mol {
29 
30 struct ChemType {
31  const static char IONS ='I';
32  const static char NONCANONICALMOLS ='M';
33  const static char SACCHARIDES ='S';
34  const static char NUCLEOTIDES ='N';
35  const static char AMINOACIDS ='A';
36  const static char COENZYMES ='E';
37  const static char WATERCOORDIONS ='C';
38  const static char DRUGS ='D';
39  const static char WATERS ='W';
40  const static char UNKNOWN ='U';
41 
42  explicit ChemType(char chem_type)
43  : chem_type_(chem_type) {
44  }
45 
47  : chem_type_(UNKNOWN) {
48  }
49 
50  bool operator==(const ChemType& cc) const {
51  return cc.chem_type_==chem_type_;
52  }
53 
54  bool operator!=(const ChemType& cc) const {
55  return cc.chem_type_!=chem_type_;
56  }
57 
58  bool IsIon() const {
59  return (chem_type_==ChemType::IONS ||
60  chem_type_==ChemType::WATERCOORDIONS);
61  }
62 
63  bool IsNucleotide() const {
64  return (chem_type_==ChemType::NUCLEOTIDES);
65  }
66 
67  bool IsSaccharide() const {
68  return (chem_type_==ChemType::SACCHARIDES);
69  }
70 
71  bool IsAminoAcid() const {
72  return (chem_type_==ChemType::AMINOACIDS);
73  }
74 
75  bool IsCoenzyme() const {
76  return (chem_type_==ChemType::COENZYMES);
77  }
78 
79  bool IsDrug() const {
80  return (chem_type_==ChemType::DRUGS);
81  }
82 
83  bool IsWater() const {
84  return (chem_type_==ChemType::WATERS);
85  }
86 
87  bool IsNonCanonical() const {
88  return (chem_type_==ChemType::NONCANONICALMOLS);
89  }
90 
91  bool IsKnown() const {
92  return (chem_type_!=ChemType::UNKNOWN);
93  }
94 
95  operator char() const {
96  return chem_type_;
97  }
98 
99 private:
100  char chem_type_;
101 };
102 
103 }} // ns
104 #endif
bool operator==(const ChemType &cc) const
Definition: chem_type.hh:50
bool IsWater() const
Definition: chem_type.hh:83
bool IsCoenzyme() const
Definition: chem_type.hh:75
bool IsNucleotide() const
Definition: chem_type.hh:63
bool IsDrug() const
Definition: chem_type.hh:79
bool IsKnown() const
Definition: chem_type.hh:91
static const char WATERS
Definition: chem_type.hh:39
static const char COENZYMES
Definition: chem_type.hh:36
static const char UNKNOWN
Definition: chem_type.hh:40
bool IsAminoAcid() const
Definition: chem_type.hh:71
static const char DRUGS
Definition: chem_type.hh:38
bool IsNonCanonical() const
Definition: chem_type.hh:87
bool IsIon() const
Definition: chem_type.hh:58
bool IsSaccharide() const
Definition: chem_type.hh:67
static const char SACCHARIDES
Definition: chem_type.hh:33
static const char NONCANONICALMOLS
Definition: chem_type.hh:32
bool operator!=(const ChemType &cc) const
Definition: chem_type.hh:54
static const char NUCLEOTIDES
Definition: chem_type.hh:34
static const char AMINOACIDS
Definition: chem_type.hh:35
static const char WATERCOORDIONS
Definition: chem_type.hh:37
static const char IONS
Definition: chem_type.hh:31
ChemType(char chem_type)
Definition: chem_type.hh:42