OpenStructure
Loading...
Searching...
No Matches
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-2020 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
23
24
25namespace ost { namespace mol {
26
27struct DLLEXPORT ChemClass {
28
29 typedef enum {
30 PEPTIDE_LINKING ='P',
31 D_PEPTIDE_LINKING ='D',
32 L_PEPTIDE_LINKING ='L',
33 RNA_LINKING ='R',
34 DNA_LINKING ='S',
35 NON_POLYMER ='N',
36 L_SACCHARIDE ='X',
37 D_SACCHARIDE ='Y',
38 SACCHARIDE ='Z',
39 WATER ='W',
40 UNKNOWN ='U'
41 } Type;
42
43 explicit ChemClass(Type chem_class): chem_class_(chem_class) { }
44
45 explicit ChemClass(char type): chem_class_(Type(type)) { }
46
47 ChemClass(): chem_class_(UNKNOWN) { }
48
49 bool operator==(const ChemClass& cc) const {
50 return cc.chem_class_ == chem_class_;
51 }
52
53 bool operator!=(const ChemClass& cc) const {
54 return !this->operator == (cc);
55 }
56
57 bool IsPeptideLinking() const {
58 return (chem_class_ == PEPTIDE_LINKING ||
59 chem_class_ == D_PEPTIDE_LINKING ||
60 chem_class_ == L_PEPTIDE_LINKING);
61 }
62 bool IsNucleotideLinking() const {
63 return (chem_class_ == DNA_LINKING ||
64 chem_class_ == RNA_LINKING);
65 }
66
67 bool IsWater() const {
68 return chem_class_ == WATER;
69 }
70
71 operator char() const {
72 return chem_class_;
73 }
74
75 bool IsSaccharide() const {
76 return (chem_class_ == SACCHARIDE ||
77 chem_class_ == L_SACCHARIDE ||
78 chem_class_ == D_SACCHARIDE);
79 }
80
81private:
82 Type chem_class_;
83};
84
85}} // ns
86#endif
Definition base.dox:1
bool operator!=(const ChemClass &cc) const
Definition chem_class.hh:53
ChemClass(char type)
Definition chem_class.hh:45
bool IsPeptideLinking() const
Definition chem_class.hh:57
bool operator==(const ChemClass &cc) const
Definition chem_class.hh:49
bool IsWater() const
Definition chem_class.hh:67
ChemClass(Type chem_class)
Definition chem_class.hh:43
bool IsSaccharide() const
Definition chem_class.hh:75
bool IsNucleotideLinking() const
Definition chem_class.hh:62