OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
property_id.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_PROPERTY_ID_HH
20 #define OST_PROPERTY_ID_HH
21 
22 /*
23  Author: Marco Biasini
24  */
25 #include <ost/message.hh>
26 
27 #include <ost/mol/module_config.hh>
28 
29 namespace ost { namespace mol {
30 
32 public:
41  typedef enum {
42  RNAME, ANAME, CNAME, ELE, RNUM, ANUM, AX, AY, AZ, OCC, AINDEX, RTYPE,
43  ISHETATM, RBFAC, ABFAC, PEPTIDE, NUCLEOTIDE, ACHARGE, RINDEX, PROTEIN,
44  LIGAND, WATER, WITHIN, UNDEF, CUSTOM
45  } ID;
46 
47  typedef enum {
48  ATOM=0, RESIDUE=1, CHAIN=2, UNSPECIFIED=3
49  } Level;
50 
51  typedef enum {
52  STRING, INT, FLOAT, VEC_DIST
53  } Type;
54 public:
55  ID id;
58 
59  Prop(ID i, Type t, Level l):
60  id(i), type(t), level(l)
61  { }
62 
63  Prop():
64  id(UNDEF), type(INT), level(ATOM)
65  { }
66 
67  bool operator==(const Prop& rhs) const
68  {
69  return id==rhs.id && type==rhs.type && level==rhs.level;
70  }
71 
72  bool operator!=(const Prop& rhs) const
73  {
74  return !this->operator==(rhs);
75  }
76 
77  String GetName() const;
78  String GetTypeName() const;
79 };
80 
84 
88 
89 
90 struct DLLEXPORT PropertyError: public ost::Error
91 {
93  ost::Error("invalid property"),
94  prop_(prop)
95  {}
96  virtual ~PropertyError() throw() {}
97 
99  {
100  return prop_;
101  }
102 private:
103  ost::mol::Prop::ID prop_;
104 };
105 
106 }} //ns
107 
108 
109 #endif
std::string String
Definition: base.hh:54
Prop DLLEXPORT_OST_MOL PropertyFromString(const String &prop)
ost::mol::Prop::ID Prop() const
Definition: property_id.hh:98
ID
Defined properties.
Definition: property_id.hh:41
bool operator!=(const Prop &rhs) const
Definition: property_id.hh:72
bool DLLEXPORT_OST_GEOM operator==(const Line2 &l1, const Line2 &l2)
PropertyError(ost::mol::Prop::ID prop)
Definition: property_id.hh:92
Prop(ID i, Type t, Level l)
Definition: property_id.hh:59
#define DLLEXPORT_OST_MOL
Prop::ID DLLEXPORT_OST_MOL PropertyIDFromString(const String &prop)
bool operator==(const Prop &rhs) const
Definition: property_id.hh:67