RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
MultithreadedSDMolSupplier.h
Go to the documentation of this file.
1//
2// Copyright (C) 2020 Shrey Aryan
3//
4// @@ All Rights Reserved @@
5// This file is part of the RDKit.
6// The contents are covered by the terms of the BSD license
7// which is included in the file license.txt, found at the root
8// of the RDKit source tree.
9//
10#ifdef RDK_BUILD_THREADSAFE_SSS
11#ifndef MULTITHREADED_SD_MOL_SUPPLIER
12#define MULTITHREADED_SD_MOL_SUPPLIER
14namespace RDKit {
15
16//! This class is still a bit experimental and the public API may change
17//! in future releases.
20 public:
21 explicit MultithreadedSDMolSupplier(
22 const std::string &fileName, bool sanitize = true, bool removeHs = true,
23 bool strictParsing = true, unsigned int numWriterThreads = 1,
24 size_t sizeInputQueue = 5, size_t sizeOutputQueue = 5);
25
26 explicit MultithreadedSDMolSupplier(
27 std::istream *inStream, bool takeOwnership = true, bool sanitize = true,
28 bool removeHs = true, bool strictParsing = true,
29 unsigned int numWriterThreads = 1, size_t sizeInputQueue = 5,
30 size_t sizeOutputQueue = 5);
31
32 MultithreadedSDMolSupplier();
33 ~MultithreadedSDMolSupplier() override;
34 void init() override {}
35
36 void checkForEnd();
37 bool getEnd() const override;
38 void setProcessPropertyLists(bool val) { df_processPropertyLists = val; }
39 bool getProcessPropertyLists() const { return df_processPropertyLists; }
40 bool getEOFHitOnRead() const { return df_eofHitOnRead; }
41
42 //! reads next record and returns whether or not EOF was hit
43 bool extractNextRecord(std::string &record, unsigned int &lineNum,
44 unsigned int &index) override;
45 void readMolProps(ROMol *mol, std::istringstream &inStream);
46 //! parses the record and returns the resulting molecule
47 ROMol *processMoleculeRecord(const std::string &record,
48 unsigned int lineNum) override;
49
50 private:
51 void initFromSettings(bool takeOwnership, bool sanitize, bool removeHs,
52 bool strictParsing, unsigned int numWriterThreads,
53 size_t sizeInputQueue, size_t sizeOutputQueue);
54
55 private:
56 bool df_end = false; //!< have we reached the end of the file?
57 int d_line = 0; //!< line number we are currently on
58 bool df_sanitize = true, df_removeHs = true, df_strictParsing = true;
59 bool df_processPropertyLists = true;
60 bool df_eofHitOnRead = false;
61 unsigned int d_currentRecordId = 1; //!< current record id
62};
63} // namespace RDKit
64#endif
65#endif
#define RDKIT_FILEPARSERS_EXPORT
Definition export.h:161
Std stuff.
bool rdvalue_is(const RDValue_cast_t)