Chemical Data Processing Library C++ API - Version 1.4.0
ScreeningDBCreator.hpp
Go to the documentation of this file.
1 /*
2  * ScreeningDBCreator.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_PHARM_SCREENINGDBCREATOR_HPP
30 #define CDPL_PHARM_SCREENINGDBCREATOR_HPP
31 
32 #include <string>
33 #include <cstddef>
34 #include <memory>
35 #include <functional>
36 
37 #include "CDPL/Pharm/APIPrefix.hpp"
38 
39 
40 namespace CDPL
41 {
42 
43  namespace Chem
44  {
45 
46  class MolecularGraph;
47  }
48 
49  namespace Pharm
50  {
51 
52  class ScreeningDBAccessor;
53 
58  {
59 
60  public:
62  typedef std::shared_ptr<ScreeningDBCreator> SharedPointer;
63 
65  typedef std::function<bool(double)> ProgressCallbackFunction;
66 
70  enum Mode
71  {
72 
78  APPEND
79  };
80 
84  virtual ~ScreeningDBCreator() {}
85 
92  virtual void open(const std::string& name, Mode mode = CREATE, bool allow_dup_entries = true) = 0;
93 
97  virtual void close() = 0;
98 
103  virtual Mode getMode() const = 0;
104 
109  virtual bool allowDuplicateEntries() const = 0;
110 
116  virtual bool process(const Chem::MolecularGraph& molgraph) = 0;
117 
124  virtual bool merge(const ScreeningDBAccessor& db_acc, const ProgressCallbackFunction& func) = 0;
125 
130  virtual const std::string& getDatabaseName() const = 0;
131 
136  virtual std::size_t getNumProcessed() const = 0;
137 
142  virtual std::size_t getNumRejected() const = 0;
143 
148  virtual std::size_t getNumDeleted() const = 0;
149 
154  virtual std::size_t getNumInserted() const = 0;
155 
156  protected:
158  {
159  return *this;
160  }
161  };
162  } // namespace Pharm
163 } // namespace CDPL
164 
165 #endif // CDPL_PHARM_SCREENINGDBCREATOR_HPP
Definition of the preprocessor macro CDPL_PHARM_API.
#define CDPL_PHARM_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Abstract base class for representations of a chemical structure as a graph of bonded atoms.
Definition: MolecularGraph.hpp:57
Abstract base class for accessors that read the data stored in pharmacophore screening databases.
Definition: ScreeningDBAccessor.hpp:58
Abstract base class for creators that build optimized pharmacophore screening databases.
Definition: ScreeningDBCreator.hpp:58
virtual Mode getMode() const =0
Returns the mode in which the currently open database was opened.
Mode
Specifies how an existing database file is treated by open().
Definition: ScreeningDBCreator.hpp:71
@ UPDATE
Update an existing database in place.
Definition: ScreeningDBCreator.hpp:76
@ CREATE
Create a new database (replacing any existing file).
Definition: ScreeningDBCreator.hpp:74
ScreeningDBCreator & operator=(const ScreeningDBCreator &)
Definition: ScreeningDBCreator.hpp:157
virtual const std::string & getDatabaseName() const =0
Returns the name of the currently open database.
virtual ~ScreeningDBCreator()
Virtual destructor.
Definition: ScreeningDBCreator.hpp:84
virtual bool allowDuplicateEntries() const =0
Tells whether duplicate molecule entries are allowed.
virtual std::size_t getNumProcessed() const =0
Returns the number of molecules processed since the database was opened.
virtual void close()=0
Closes the currently open database.
virtual std::size_t getNumDeleted() const =0
Returns the number of entries that were deleted since the database was opened.
std::function< bool(double)> ProgressCallbackFunction
Type of the progress-reporting callback (argument: fraction in [0, 1], return: true to continue,...
Definition: ScreeningDBCreator.hpp:65
virtual std::size_t getNumRejected() const =0
Returns the number of molecules that were rejected (e.g. as duplicates) since the database was opened...
virtual std::size_t getNumInserted() const =0
Returns the number of entries that were inserted since the database was opened.
virtual bool process(const Chem::MolecularGraph &molgraph)=0
Processes molgraph and adds it (or its derived pharmacophores) to the database.
std::shared_ptr< ScreeningDBCreator > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated ScreeningDBCreator instances.
Definition: ScreeningDBCreator.hpp:62
virtual bool merge(const ScreeningDBAccessor &db_acc, const ProgressCallbackFunction &func)=0
Merges the contents of db_acc into the currently open database.
virtual void open(const std::string &name, Mode mode=CREATE, bool allow_dup_entries=true)=0
Opens the database identified by name in the specified mode.
The namespace of the Chemical Data Processing Library.