11 #ifndef _RD_MOLWRITERS_H_ 12 #define _RD_MOLWRITERS_H_ 26 virtual void write(
const ROMol &mol,
int confId = defaultConfId) = 0;
27 virtual void flush() = 0;
28 virtual void close() = 0;
30 virtual unsigned int numMols()
const = 0;
57 SmilesWriter(
const std::string &fileName,
const std::string &delimiter =
" ",
58 const std::string &nameHeader =
"Name",
59 bool includeHeader =
true,
bool isomericSmiles =
false,
60 bool kekuleSmiles =
false);
62 SmilesWriter(std::ostream *outStream, std::string delimiter =
" ",
63 std::string nameHeader =
"Name",
bool includeHeader =
true,
64 bool takeOwnership =
false,
bool isomericSmiles =
false,
65 bool kekuleSmiles =
false);
74 void write(
const ROMol &mol,
int confId = defaultConfId);
83 if (dp_ostream->good())
84 dp_ostream->setstate(std::ios::badbit);
85 }
catch (
const std::runtime_error& e) {
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);
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())
162 dp_ostream->setstate(std::ios::badbit);
163 }
catch (
const std::runtime_error& e) {
171 std::ostream *tmp_ostream = dp_ostream;
180 unsigned int numMols()
const {
return d_molid; };
189 void writeProperty(
const ROMol &mol,
const std::string &name);
191 std::ostream *dp_ostream;
193 unsigned int d_molid;
214 TDTWriter(std::ostream *outStream,
bool takeOwnership =
false);
223 void write(
const ROMol &mol,
int confId = defaultConfId);
232 if (dp_ostream->good())
233 dp_ostream->setstate(std::ios::badbit);
234 }
catch (
const std::runtime_error& e) {
242 std::ostream *tmp_ostream = dp_ostream;
251 unsigned int numMols()
const {
return d_molid; };
259 void setNumDigits(
unsigned int numDigits) { d_numDigits = numDigits; };
263 void writeProperty(
const ROMol &mol,
const std::string &name);
265 std::ostream *dp_ostream;
267 unsigned int d_molid;
279 PDBWriter(
const std::string &fileName,
unsigned int flavor = 0);
280 PDBWriter(std::ostream *outStream,
bool takeOwnership =
false,
281 unsigned int flavor = 0);
285 void write(
const ROMol &mol,
int confId = defaultConfId);
296 if (dp_ostream->good())
297 dp_ostream->setstate(std::ios::badbit);
298 }
catch (
const std::runtime_error& e) {
306 std::ostream *tmp_ostream = dp_ostream;
315 unsigned int numMols()
const {
return d_count; };
318 std::ostream *dp_ostream;
319 unsigned int d_flavor;
320 unsigned int d_count;
void close()
close our stream (the writer cannot be used again)
void setProps(const STR_VECT &)
unsigned int numMols() const
get the number of molecules written so far
void close()
close our stream (the writer cannot be used again)
virtual unsigned int numMols() const =0
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)
ROMol is a molecule class that is intended to have a fixed topology.
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)
virtual void setProps(const STR_VECT &propNames)=0
bool getForceV3000() const
void setForceV3000(bool val)
Includes a bunch of functionality for handling Atom and Bond queries.
virtual void write(const ROMol &mol, int confId=defaultConfId)=0
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)