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:
64  typedef std::shared_ptr<ScreeningDBCreator> SharedPointer;
65 
69  typedef std::function<bool(double)> ProgressCallbackFunction;
70 
74  enum Mode
75  {
76 
81 
86 
90  APPEND
91  };
92 
96  virtual ~ScreeningDBCreator() {}
97 
104  virtual void open(const std::string& name, Mode mode = CREATE, bool allow_dup_entries = true) = 0;
105 
109  virtual void close() = 0;
110 
115  virtual Mode getMode() const = 0;
116 
121  virtual bool allowDuplicateEntries() const = 0;
122 
128  virtual bool process(const Chem::MolecularGraph& molgraph) = 0;
129 
136  virtual bool merge(const ScreeningDBAccessor& db_acc, const ProgressCallbackFunction& func) = 0;
137 
142  virtual const std::string& getDatabaseName() const = 0;
143 
148  virtual std::size_t getNumProcessed() const = 0;
149 
154  virtual std::size_t getNumRejected() const = 0;
155 
160  virtual std::size_t getNumDeleted() const = 0;
161 
166  virtual std::size_t getNumInserted() const = 0;
167 
168  protected:
170  {
171  return *this;
172  }
173  };
174  } // namespace Pharm
175 } // namespace CDPL
176 
177 #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:75
@ UPDATE
Update an existing database in place.
Definition: ScreeningDBCreator.hpp:85
@ CREATE
Create a new database (replacing any existing file).
Definition: ScreeningDBCreator.hpp:80
ScreeningDBCreator & operator=(const ScreeningDBCreator &)
Definition: ScreeningDBCreator.hpp:169
virtual const std::string & getDatabaseName() const =0
Returns the name of the currently open database.
virtual ~ScreeningDBCreator()
Virtual destructor.
Definition: ScreeningDBCreator.hpp:96
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:69
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:64
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.