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 &) {
93 std::ostream *tmp_ostream = dp_ostream;
102 unsigned int numMols()
const {
return d_molid; };
106 void init(
const std::string &delimiter,
const std::string &nameHeader,
107 bool includeHeader,
bool isomericSmiles,
bool kekuleSmiles);
110 void dumpHeader()
const;
112 std::ostream *dp_ostream;
114 bool df_includeHeader;
115 unsigned int d_molid;
117 std::string d_nameHeader;
119 bool df_isomericSmiles;
120 bool df_kekuleSmiles;
137 SDWriter(
const std::string &fileName);
138 SDWriter(std::ostream *outStream,
bool takeOwnership =
false);
144 void setProps(
const STR_VECT &propNames);
147 static std::string getText(
const ROMol &mol,
int confId = defaultConfId,
148 bool kekulize =
true,
bool force_V3000 =
false,
149 int molid = -1,
STR_VECT *propNames = NULL);
152 void write(
const ROMol &mol,
int confId = defaultConfId);
161 if (dp_ostream->good()) dp_ostream->setstate(std::ios::badbit);
162 }
catch (
const std::runtime_error &) {
170 std::ostream *tmp_ostream = dp_ostream;
179 unsigned int numMols()
const {
return d_molid; };
188 void writeProperty(
const ROMol &mol,
const std::string &name);
190 std::ostream *dp_ostream;
192 unsigned int d_molid;
213 TDTWriter(std::ostream *outStream,
bool takeOwnership =
false);
219 void setProps(
const STR_VECT &propNames);
222 void write(
const ROMol &mol,
int confId = defaultConfId);
231 if (dp_ostream->good()) dp_ostream->setstate(std::ios::badbit);
232 }
catch (
const std::runtime_error &) {
240 std::ostream *tmp_ostream = dp_ostream;
249 unsigned int numMols()
const {
return d_molid; };
257 void setNumDigits(
unsigned int numDigits) { d_numDigits = numDigits; };
261 void writeProperty(
const ROMol &mol,
const std::string &name);
263 std::ostream *dp_ostream;
265 unsigned int d_molid;
277 PDBWriter(
const std::string &fileName,
unsigned int flavor = 0);
278 PDBWriter(std::ostream *outStream,
bool takeOwnership =
false,
279 unsigned int flavor = 0);
283 void write(
const ROMol &mol,
int confId = defaultConfId);
294 if (dp_ostream->good()) dp_ostream->setstate(std::ios::badbit);
295 }
catch (
const std::runtime_error &) {
303 std::ostream *tmp_ostream = dp_ostream;
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)