OpenStructure
Loading...
Searching...
No Matches
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-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_CONOP_COMPOUND_LIB_HH
20#define OST_CONOP_COMPOUND_LIB_HH
21
22#include <map>
23#include <boost/shared_ptr.hpp>
24#include <sqlite3.h>
25
26#include "module_config.hh"
27#include "compound.hh"
28#include "compound_lib_base.hh"
29
30namespace ost { namespace conop {
31
32class CompoundLib;
33
34typedef boost::shared_ptr<CompoundLib> CompoundLibPtr;
35typedef std::vector<CompoundPtr> CompoundPtrList;
36
38public:
39 static CompoundLibPtr Load(const String& database, bool readonly=true);
40 static CompoundLibPtr Create(const String& database);
42
43 virtual CompoundPtr FindCompound(const String& id,
44 Compound::Dialect dialect) const;
45 virtual CompoundPtrList FindCompounds(const String& query,
46 const String& by,
47 Compound::Dialect dialect) const;
48 void AddCompound(const CompoundPtr& compound);
49 CompoundLibPtr Copy(const String& filename) const;
50 void ClearCache();
53 void SetChemLibInfo(void);
54private:
56
57 void LoadAtomsFromDB(CompoundPtr comp, int pk) const;
58 void LoadBondsFromDB(CompoundPtr comp, int pk) const;
59 String BuildFindCompoundQuery(const String& id,
60 Compound::Dialect dialect,
61 const String& by) const;
62 CompoundPtr LoadCompoundFromDB(sqlite3_stmt* stmt) const;
63private:
64 struct Database;
65 Database* db_;
66 mutable CompoundMap compound_cache_;
67 bool smiles_available_; //whether smiles are available in db - introduced in 2.6.0
68 bool obsolete_available_; //whether obsolete info is available in db - introduced in 2.6.0
69 bool charges_available_; //whether atom charges are available in db - introduced in 2.6.0
70 Date creation_date_;
71 String ost_version_used_;
72};
73
74}}
75
76#endif
virtual CompoundPtr FindCompound(const String &id, Compound::Dialect dialect) const
String GetOSTVersionUsed(void)
static CompoundLibPtr Load(const String &database, bool readonly=true)
static CompoundLibPtr Create(const String &database)
virtual CompoundPtrList FindCompounds(const String &query, const String &by, Compound::Dialect dialect) const
void AddCompound(const CompoundPtr &compound)
CompoundLibPtr Copy(const String &filename) const
#define DLLEXPORT_OST_CONOP
std::string String
Definition base.hh:54
boost::shared_ptr< Compound > CompoundPtr
Definition compound.hh:145
boost::shared_ptr< CompoundLib > CompoundLibPtr
std::vector< CompoundPtr > CompoundPtrList
std::map< String, CompoundPtr > CompoundMap
Definition compound.hh:338
Definition base.dox:1