OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
compound_lib.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-2011 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_CONOP_COMPOUND_LIB_HH
20 #define OST_CONOP_COMPOUND_LIB_HH
21 
22 #include <map>
23 #include <boost/shared_ptr.hpp>
24 
25 #include "module_config.hh"
26 #include "compound.hh"
27 #include "compound_lib_base.hh"
28 
29 namespace ost { namespace conop {
30 
32 
33 typedef boost::shared_ptr<CompoundLib> CompoundLibPtr;
34 
36 public:
37  static CompoundLibPtr Load(const String& database, bool readonly=true);
38  static CompoundLibPtr Create(const String& database);
39  ~CompoundLib();
40 
41  virtual CompoundPtr FindCompound(const String& id,
42  Compound::Dialect dialect) const;
43  void AddCompound(const CompoundPtr& compound);
44  CompoundLibPtr Copy(const String& filename) const;
45  void ClearCache();
46  Date GetCreationDate(void);
47  String GetOSTVersionUsed(void);
48  void SetChemLibInfo(void);
49 private:
50  CompoundLib();
51 
52  void LoadAtomsFromDB(CompoundPtr comp, int pk) const;
53  void LoadBondsFromDB(CompoundPtr comp, int pk) const;
54 private:
55  struct Database;
56  Database* db_;
57  mutable CompoundMap compound_cache_;
58  bool chem_type_available_; // wether pdbx_type is available in db
59  bool name_available_; // wether name is available in db
60  bool inchi_available_; //whether inchi is available in db
61  Date creation_date_;
62  String ost_version_used_;
63 };
64 
65 }}
66 
67 #endif
std::string String
Definition: base.hh:54
#define DLLEXPORT_OST_CONOP
std::map< String, CompoundPtr > CompoundMap
Definition: compound.hh:293
boost::shared_ptr< CompoundLib > CompoundLibPtr
Definition: compound_lib.hh:31
boost::shared_ptr< Compound > CompoundPtr
Definition: compound.hh:131