00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_CONOP_COMPOUND_LIB_HH
00020 #define OST_CONOP_COMPOUND_LIB_HH
00021
00022 #include <map>
00023 #include <boost/shared_ptr.hpp>
00024
00025
00026 #include <ost/db/sqlite3.h>
00027
00028 #include "module_config.hh"
00029 #include "compound.hh"
00030 #include "compound_lib_base.hh"
00031
00032 namespace ost { namespace conop {
00033
00034 class CompoundLib;
00035
00036 typedef boost::shared_ptr<CompoundLib> CompoundLibPtr;
00037
00038 class DLLEXPORT_OST_CONOP CompoundLib : public CompoundLibBase {
00039 public:
00040 static CompoundLibPtr Load(const String& database, bool readonly=true);
00041 static CompoundLibPtr Create(const String& database);
00042 ~CompoundLib();
00043
00044 virtual CompoundPtr FindCompound(const String& id,
00045 Compound::Dialect dialect) const;
00046 void AddCompound(const CompoundPtr& compound);
00047 CompoundLibPtr Copy(const String& filename) const;
00048 void ClearCache();
00049 Date GetCreationDate(void);
00050 String GetOSTVersionUsed(void);
00051 void SetChemLibInfo(void);
00052 private:
00053 CompoundLib();
00054
00055 void LoadAtomsFromDB(CompoundPtr comp, int pk) const;
00056 void LoadBondsFromDB(CompoundPtr comp, int pk) const;
00057 private:
00058 mutable CompoundMap compound_cache_;
00059 sqlite3* conn_;
00060 bool chem_type_available_;
00061 bool name_available_;
00062 bool inchi_available_;
00063 Date creation_date_;
00064 String ost_version_used_;
00065 };
00066
00067 }}
00068
00069 #endif