10#ifdef RDK_BUILD_THREADSAFE_SSS
11#ifndef MULTITHREADED_SMILES_MOL_SUPPLIER
12#define MULTITHREADED_SMILES_MOL_SUPPLIER
16namespace FileParsers {
22 explicit MultithreadedSmilesMolSupplier(
23 const std::string &fileName,
const Parameters ¶ms = Parameters(),
24 const SmilesMolSupplierParams &parseParams = SmilesMolSupplierParams());
26 explicit MultithreadedSmilesMolSupplier(
27 std::istream *inStream,
bool takeOwnership =
true,
28 const Parameters ¶ms = Parameters(),
29 const SmilesMolSupplierParams &parseParams = SmilesMolSupplierParams());
30 MultithreadedSmilesMolSupplier();
31 ~MultithreadedSmilesMolSupplier()
override;
33 void init()
override {}
35 bool getEnd()
const override;
37 void processTitleLine();
39 bool extractNextRecord(std::string &record,
unsigned int &lineNum,
40 unsigned int &index)
override;
42 RWMol *processMoleculeRecord(
const std::string &record,
43 unsigned int lineNum)
override;
46 void initFromSettings(
47 bool takeOwnership,
const Parameters ¶ms,
48 const SmilesMolSupplierParams &parseParams = SmilesMolSupplierParams());
54 unsigned int d_currentRecordId = 1;
55 SmilesMolSupplierParams d_parseParams;
62 :
public MolSupplier {
66 using ContainedType = v2::FileParsers::MultithreadedSmilesMolSupplier;
67 MultithreadedSmilesMolSupplier() {}
68 explicit MultithreadedSmilesMolSupplier(
69 const std::string &fileName,
const std::string &delimiter =
" \t",
70 int smilesColumn = 0,
int nameColumn = 1,
bool titleLine =
true,
71 bool sanitize =
true,
unsigned int numWriterThreads = 1,
72 size_t sizeInputQueue = 5,
size_t sizeOutputQueue = 5) {
73 v2::FileParsers::MultithreadedSmilesMolSupplier::Parameters params;
74 params.numWriterThreads = numWriterThreads;
75 params.sizeInputQueue = sizeInputQueue;
76 params.sizeOutputQueue = sizeOutputQueue;
77 v2::FileParsers::SmilesMolSupplierParams parseParams;
78 parseParams.delimiter = delimiter;
79 parseParams.smilesColumn = smilesColumn;
80 parseParams.nameColumn = nameColumn;
81 parseParams.titleLine = titleLine;
82 parseParams.parseParameters.sanitize = sanitize;
84 dp_supplier.reset(
new v2::FileParsers::MultithreadedSmilesMolSupplier(
85 fileName, params, parseParams));
88 explicit MultithreadedSmilesMolSupplier(
89 std::istream *inStream,
bool takeOwnership =
true,
90 const std::string &delimiter =
" \t",
int smilesColumn = 0,
91 int nameColumn = 1,
bool titleLine =
true,
bool sanitize =
true,
92 unsigned int numWriterThreads = 1,
size_t sizeInputQueue = 5,
93 size_t sizeOutputQueue = 5) {
94 v2::FileParsers::MultithreadedSmilesMolSupplier::Parameters params;
95 params.numWriterThreads = numWriterThreads;
96 params.sizeInputQueue = sizeInputQueue;
97 params.sizeOutputQueue = sizeOutputQueue;
98 v2::FileParsers::SmilesMolSupplierParams parseParams;
99 parseParams.delimiter = delimiter;
100 parseParams.smilesColumn = smilesColumn;
101 parseParams.nameColumn = nameColumn;
102 parseParams.titleLine = titleLine;
103 parseParams.parseParameters.sanitize = sanitize;
105 dp_supplier.reset(
new v2::FileParsers::MultithreadedSmilesMolSupplier(
106 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();
126 std::string getLastItemText()
const {
128 return static_cast<ContainedType *
>(dp_supplier.get())->getLastItemText();
#define PRECONDITION(expr, mess)
#define RDKIT_FILEPARSERS_EXPORT
std::vector< std::string > STR_VECT
bool rdvalue_is(const RDValue_cast_t)