12 #ifndef _RD_MOLWRITERS_H_ 13 #define _RD_MOLWRITERS_H_ 27 virtual void write(
const ROMol &mol,
int confId = defaultConfId) = 0;
28 virtual void flush() = 0;
29 virtual void close() = 0;
30 virtual void setProps(
const STR_VECT &propNames) = 0;
31 virtual unsigned int numMols()
const = 0;
58 SmilesWriter(
const std::string &fileName,
const std::string &delimiter =
" ",
59 const std::string &nameHeader =
"Name",
60 bool includeHeader =
true,
bool isomericSmiles =
true,
61 bool kekuleSmiles =
false);
63 SmilesWriter(std::ostream *outStream, std::string delimiter =
" ",
64 std::string nameHeader =
"Name",
bool includeHeader =
true,
65 bool takeOwnership =
false,
bool isomericSmiles =
true,
66 bool kekuleSmiles =
false);
72 void setProps(
const STR_VECT &propNames);
75 void write(
const ROMol &mol,
int confId = defaultConfId);
84 if (dp_ostream->good()) dp_ostream->setstate(std::ios::badbit);
85 }
catch (
const std::runtime_error &) {
101 unsigned int numMols()
const {
return d_molid; };
105 void init(
const std::string &delimiter,
const std::string &nameHeader,
106 bool includeHeader,
bool isomericSmiles,
bool kekuleSmiles);
109 void dumpHeader()
const;
111 std::ostream *dp_ostream;
113 bool df_includeHeader;
114 unsigned int d_molid;
116 std::string d_nameHeader;
118 bool df_isomericSmiles;
119 bool df_kekuleSmiles;
136 SDWriter(
const std::string &fileName);
137 SDWriter(std::ostream *outStream,
bool takeOwnership =
false);
143 void setProps(
const STR_VECT &propNames);
146 static std::string getText(
const ROMol &mol,
int confId = defaultConfId,
147 bool kekulize =
true,
bool force_V3000 =
false,
148 int molid = -1,
STR_VECT *propNames = NULL);
151 void write(
const ROMol &mol,
int confId = defaultConfId);
160 if (dp_ostream->good()) dp_ostream->setstate(std::ios::badbit);
161 }
catch (
const std::runtime_error &) {
173 dp_ostream =
nullptr;
177 unsigned int numMols()
const {
return d_molid; };
186 void writeProperty(
const ROMol &mol,
const std::string &name);
188 std::ostream *dp_ostream;
190 unsigned int d_molid;
211 TDTWriter(std::ostream *outStream,
bool takeOwnership =
false);
217 void setProps(
const STR_VECT &propNames);
220 void write(
const ROMol &mol,
int confId = defaultConfId);
229 if (dp_ostream->good()) dp_ostream->setstate(std::ios::badbit);
230 }
catch (
const std::runtime_error &) {
238 if (dp_ostream && d_molid > 0) {
239 *dp_ostream <<
"|\n";
246 dp_ostream =
nullptr;
250 unsigned int numMols()
const {
return d_molid; };
258 void setNumDigits(
unsigned int numDigits) { d_numDigits = numDigits; };
262 void writeProperty(
const ROMol &mol,
const std::string &name);
264 std::ostream *dp_ostream;
266 unsigned int d_molid;
278 PDBWriter(
const std::string &fileName,
unsigned int flavor = 0);
279 PDBWriter(std::ostream *outStream,
bool takeOwnership =
false,
280 unsigned int flavor = 0);
284 void write(
const ROMol &mol,
int confId = defaultConfId);
295 if (dp_ostream->good()) dp_ostream->setstate(std::ios::badbit);
296 }
catch (
const std::runtime_error &) {
308 dp_ostream =
nullptr;
312 unsigned int numMols()
const {
return d_count; };
315 std::ostream *dp_ostream;
316 unsigned int d_flavor;
317 unsigned int d_count;
void close()
close our stream (the writer cannot be used again)
void setProps(const STR_VECT &)
#define RDKIT_FILEPARSERS_EXPORT
unsigned int numMols() const
get the number of molecules written so far
void close()
close our stream (the writer cannot be used again)
void flush()
flush the ostream
void flush()
flush the ostream
Defines the primary molecule class ROMol as well as associated typedefs.
void close()
close our stream (the writer cannot be used again)
bool getWriteNames() const
void close()
close our stream (the writer cannot be used again)
void flush()
flush the ostream
unsigned int numMols() const
get the number of molecules written so far
unsigned int numMols() const
get the number of molecules written so far
unsigned int getNumDigits() const
void setNumDigits(unsigned int numDigits)
void setWriteNames(bool state=true)
bool getForceV3000() const
void setForceV3000(bool val)
unsigned int numMols() const
get the number of molecules written so far
#define PRECONDITION(expr, mess)
void setWrite2D(bool state=true)
void flush()
flush the ostream
std::vector< std::string > STR_VECT
void setKekulize(bool val)