Chemical Data Processing Library C++ API - Version 1.4.0
PSDMoleculeReader.hpp
Go to the documentation of this file.
1 /*
2  * PSDMoleculeReader.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_PSDMOLECULEREADER_HPP
30 #define CDPL_PHARM_PSDMOLECULEREADER_HPP
31 
32 #include <string>
33 #include <iosfwd>
34 
35 #include "CDPL/Pharm/APIPrefix.hpp"
37 #include "CDPL/Base/DataReader.hpp"
38 
39 
40 namespace CDPL
41 {
42 
43  namespace Chem
44  {
45 
46  class Molecule;
47  }
48 
49  namespace Pharm
50  {
51 
55  class CDPL_PHARM_API PSDMoleculeReader : public Base::DataReader<Chem::Molecule>
56  {
57 
58  public:
64  PSDMoleculeReader(std::istream& is);
65 
71  PSDMoleculeReader(const std::string& file_name);
72 
77 
84  PSDMoleculeReader& read(Chem::Molecule& mol, bool overwrite = true);
85 
93  PSDMoleculeReader& read(std::size_t idx, Chem::Molecule& mol, bool overwrite = true);
94 
100 
105  bool hasMoreData();
106 
111  std::size_t getRecordIndex() const;
112 
117  void setRecordIndex(std::size_t idx);
118 
123  std::size_t getNumRecords();
124 
129  operator const void*() const;
130 
135  bool operator!() const;
136 
137  private:
138  PSDScreeningDBAccessor accessor;
139  std::size_t recordIndex;
140  std::size_t numRecords;
141  bool state;
142  };
143  } // namespace Pharm
144 } // namespace CDPL
145 
146 #endif // CDPL_PHARM_PSDMOLECULEREADER_HPP
Definition of class CDPL::Base::DataReader.
Definition of class CDPL::Pharm::PSDScreeningDBAccessor.
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.
Interface for reading data objects of a given type from an arbitrary data source.
Definition: DataReader.hpp:73
Abstract base class representing a mutable molecular graph that owns its atoms and bonds.
Definition: Molecule.hpp:53
Reader for molecule data in the CDPL PSD-format.
Definition: PSDMoleculeReader.hpp:56
PSDMoleculeReader & read(std::size_t idx, Chem::Molecule &mol, bool overwrite=true)
Reads the molecule at record index idx into mol.
std::size_t getRecordIndex() const
Returns the current record index.
bool operator!() const
Tells whether the reader is in a bad (non-readable) state.
PSDMoleculeReader(std::istream &is)
Constructs a PSDMoleculeReader instance that will read the molecule data from the input stream is.
void setRecordIndex(std::size_t idx)
Sets the current record index.
bool hasMoreData()
Tells whether the reader has more records to read.
PSDMoleculeReader & read(Chem::Molecule &mol, bool overwrite=true)
Reads the next molecule into mol.
PSDMoleculeReader & skip()
Skips the next molecule record (advances the current record index).
std::size_t getNumRecords()
Returns the total number of records.
PSDMoleculeReader(const std::string &file_name)
Constructs a PSDMoleculeReader instance that will read the molecule data from the input file file_nam...
Pharm::ScreeningDBAccessor implementation that reads pharmacophore screening databases stored in the ...
Definition: PSDScreeningDBAccessor.hpp:51
The namespace of the Chemical Data Processing Library.