10#ifdef RDK_BUILD_THREADSAFE_SSS
11#ifndef MULTITHREADED_SD_MOL_SUPPLIER
12#define MULTITHREADED_SD_MOL_SUPPLIER
26 :
public MultithreadedMolSupplier {
28 explicit MultithreadedSDMolSupplier(
29 const std::string &fileName,
const Parameters ¶ms = Parameters(),
30 const MolFileParserParams &parseParams = MolFileParserParams());
32 explicit MultithreadedSDMolSupplier(
33 std::istream *inStream,
bool takeOwnership =
true,
34 const Parameters ¶ms = Parameters(),
35 const MolFileParserParams &parseParams = MolFileParserParams());
37 MultithreadedSDMolSupplier();
39 ~MultithreadedSDMolSupplier() final { close(); }
41 void setProcessPropertyLists(
bool val) { df_processPropertyLists = val; }
43 bool getProcessPropertyLists()
const {
return df_processPropertyLists; }
45 bool getEOFHitOnRead() const final {
return df_eofHitOnRead; }
48 bool extractNextRecord(std::string &record,
unsigned int &lineNum,
49 unsigned int &index)
final;
52 std::unique_ptr<RWMol> processMoleculeRecord(
const std::string &record,
53 unsigned int lineNum)
final;
56 void initFromSettings(
bool takeOwnership,
const Parameters ¶ms,
57 const MolFileParserParams &parseParams);
59 void readMolProps(RWMol &mol, std::istringstream &inStream);
61 bool df_processPropertyLists =
true;
62 bool df_eofHitOnRead =
false;
63 MolFileParserParams d_parseParams;
73 using ContainedType = v2::FileParsers::MultithreadedSDMolSupplier;
74 MultithreadedSDMolSupplier() {}
75 explicit MultithreadedSDMolSupplier(
76 const std::string &fileName,
bool sanitize =
true,
bool removeHs =
true,
77 bool strictParsing =
true,
unsigned int numWriterThreads = 1,
78 size_t sizeInputQueue = 5,
size_t sizeOutputQueue = 5) {
79 v2::FileParsers::MultithreadedSDMolSupplier::Parameters params;
80 params.numWriterThreads = numWriterThreads;
81 params.sizeInputQueue = sizeInputQueue;
82 params.sizeOutputQueue = sizeOutputQueue;
83 v2::FileParsers::MolFileParserParams parseParams;
84 parseParams.sanitize = sanitize;
86 parseParams.strictParsing = strictParsing;
88 dp_supplier.reset(
new v2::FileParsers::MultithreadedSDMolSupplier(
89 fileName, params, parseParams));
92 explicit MultithreadedSDMolSupplier(
93 std::istream *inStream,
bool takeOwnership =
true,
bool sanitize =
true,
94 bool removeHs =
true,
bool strictParsing =
true,
95 unsigned int numWriterThreads = 1,
size_t sizeInputQueue = 5,
96 size_t sizeOutputQueue = 5) {
97 v2::FileParsers::MultithreadedSDMolSupplier::Parameters params;
98 params.numWriterThreads = numWriterThreads;
99 params.sizeInputQueue = sizeInputQueue;
100 params.sizeOutputQueue = sizeOutputQueue;
101 v2::FileParsers::MolFileParserParams parseParams;
102 parseParams.sanitize = sanitize;
104 parseParams.strictParsing = strictParsing;
106 dp_supplier.reset(
new v2::FileParsers::MultithreadedSDMolSupplier(
107 inStream, takeOwnership, params, parseParams));
110 bool getEOFHitOnRead()
const {
112 return static_cast<ContainedType *
>(dp_supplier.get())->getEOFHitOnRead();
121 unsigned int getLastRecordId()
const {
123 return static_cast<ContainedType *
>(dp_supplier.get())->getLastRecordId();
127 std::string getLastItemText()
const {
129 return static_cast<ContainedType *
>(dp_supplier.get())->getLastItemText();
132 void setProcessPropertyLists(
bool val) {
134 static_cast<ContainedType *
>(dp_supplier.get())
135 ->setProcessPropertyLists(val);
138 bool getProcessPropertyLists()
const {
140 return static_cast<ContainedType *
>(dp_supplier.get())
141 ->getProcessPropertyLists();
#define PRECONDITION(expr, mess)
#define RDKIT_FILEPARSERS_EXPORT
RDKIT_GRAPHMOL_EXPORT ROMol * removeHs(const ROMol &mol, bool implicitOnly, bool updateExplicitCount=false, bool sanitize=true)
returns a copy of a molecule with hydrogens removed