00001
00009 #ifndef HAMATDB_H
00010 #define HAMATDB_H
00011
00012 #include "db.h"
00013 #include "db_cxx.h"
00014 #include "halinalg.h"
00015 #include "haatgroup.h"
00016 #include "command.h"
00017
00018 class HaDbKey: public Dbt
00019 {
00020 public:
00021 HaDbKey();
00022 virtual ~HaDbKey();
00023
00024 virtual double GetProtect() const;
00025 virtual ostream& Print_To(ostream& s) const;
00026
00027 protected:
00028
00029
00030 };
00031
00032 enum Operator_Type{OPER_UNDEF=0, OPER_R=1,OPER_RxDel=2,OPER_ET_HEFF_HF=3};
00033
00034 istream& operator>>(istream& s, Operator_Type& oper_type);
00035
00036
00037 class HaGrpOperID: public HaDbKey
00038 {
00039 public:
00040 HaGrpOperID();
00041 HaGrpOperID(const Operator_Type oper_type, const int op_comp);
00042 HaGrpOperID(const Operator_Type oper_type, const int op_comp,
00043 const ChemGroup& g1, const ChemGroup& g2);
00044 virtual ~HaGrpOperID();
00045
00046 bool set(const Operator_Type oper_type, const int op_comp);
00047
00048 bool set(const Operator_Type oper_type, const int op_comp,
00049 const ChemGroup& g1, const ChemGroup& g2);
00050
00051 virtual double GetProtect() const;
00052
00053 friend int compare_GrpOperID(const DBT* pg_op_id1, const DBT* pg_op_id2);
00054
00055 friend ostream& operator<<(ostream& s, HaGrpOperID& g_op_id);
00056 friend class HaGrp4MatID;
00057
00058
00059 int* comp_coarse(const Dbt*, const Dbt*);
00060
00061 protected:
00062 HaString id_str;
00063 };
00064
00065 class HaGrp4MatID: public HaDbKey
00067 {
00068 public:
00069 HaGrp4MatID();
00070 HaGrp4MatID( const HaGrpOperID& g_op_id1, const HaGrpOperID& g_op_id2);
00071 virtual ~HaGrp4MatID();
00072
00073 virtual double GetProtect() const;
00074
00075 friend int compare_Grp4MatID(const DBT* pg_op_id1, const DBT* pg_op_id2);
00076
00077 friend ostream& operator<<(ostream& s, const HaGrp4MatID& g4_mat_id);
00078
00079 protected:
00080 HaString id_str;
00081 };
00082
00083
00084
00085 class HaMatDB
00087 {
00088 public:
00089 HaMatDB();
00090 HaMatDB(const char* fname,const char* mode="r" );
00091 virtual ~HaMatDB();
00092
00093 bool virtual open(const char* fname, const char* mode );
00094 bool close();
00095
00096 bool is_open();
00097
00098 bool put(HaDbKey& g_op_id, const HaMat_double& fgmat);
00099
00100 bool get(HaDbKey& g_op_id, HaMat_double& fgmat);
00101
00102 bool virtual ListKeys() ;
00103 bool virtual ListAll(ostream& s);
00104
00105 protected:
00106 DbInfo db_info;
00107 Db *db_ptr;
00108
00109 int debug_level;
00110
00111 };
00112
00113 class HaGrpOperDB: public HaMatDB
00114 {
00115 public:
00116 HaGrpOperDB();
00117 HaGrpOperDB(const char* fname, const char* mode="r" );
00118 virtual ~HaGrpOperDB();
00119
00120 protected:
00121
00122 };
00123
00124
00125 class HaGrp4MatDB: public HaMatDB
00126 {
00127 public:
00128 HaGrp4MatDB();
00129 HaGrp4MatDB(const char* fname, const char* mode="r" );
00130 virtual ~HaGrp4MatDB();
00131
00132 protected:
00133
00134 };
00135
00136 #ifdef HAMATDB_CPP
00137
00138 HaMatDB Act_MatDb;
00139
00140 #else
00141
00142 extern HaMatDB Act_MatDb;
00143
00144 #endif
00145
00146
00147
00148 #endif
00149