00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_PROPERTY_ID_HH
00020 #define OST_PROPERTY_ID_HH
00021
00022
00023
00024
00025 #include <ost/message.hh>
00026
00027 #include <ost/mol/module_config.hh>
00028
00029 namespace ost { namespace mol {
00030
00031 struct DLLEXPORT_OST_MOL Prop {
00032 public:
00041 typedef enum {
00042 RNAME, ANAME, CNAME, ELE, RNUM, ANUM, AX, AY, AZ, OCC, RTYPE, ISHETATM,
00043 RBFAC, ABFAC, PEPTIDE, ACHARGE, RINDEX, WITHIN, UNDEF, CUSTOM
00044 } ID;
00045
00046 typedef enum {
00047 ATOM=0, RESIDUE=1, CHAIN=2, UNSPECIFIED=3
00048 } Level;
00049
00050 typedef enum {
00051 STRING, INT, FLOAT, VEC_DIST
00052 } Type;
00053 public:
00054 ID id;
00055 Type type;
00056 Level level;
00057
00058 Prop(ID i, Type t, Level l):
00059 id(i), type(t), level(l)
00060 { }
00061
00062 Prop():
00063 id(UNDEF), type(INT), level(ATOM)
00064 { }
00065
00066 bool operator==(const Prop& rhs) const
00067 {
00068 return id==rhs.id && type==rhs.type && level==rhs.level;
00069 }
00070
00071 bool operator!=(const Prop& rhs) const
00072 {
00073 return !this->operator==(rhs);
00074 }
00075
00076 String GetName() const;
00077 String GetTypeName() const;
00078 };
00079
00082 Prop::ID DLLEXPORT_OST_MOL PropertyIDFromString(const String& prop);
00083
00086 Prop DLLEXPORT_OST_MOL PropertyFromString(const String& prop);
00087
00088
00089 struct DLLEXPORT PropertyError: public std::exception
00090 {
00091 PropertyError(ost::mol::Prop::ID prop):
00092 prop_(prop)
00093 {}
00094 virtual ~PropertyError() throw() {}
00095 virtual const char* what() const throw() {
00096 return "invalid property";
00097 }
00098
00099 ost::mol::Prop::ID Prop() const
00100 {
00101 return prop_;
00102 }
00103 private:
00104 ost::mol::Prop::ID prop_;
00105 };
00106
00107 }}
00108
00109
00110 #endif