1 #ifndef GGL_CHEM_SMILESWRITEROB_HH_
2 #define GGL_CHEM_SMILESWRITEROB_HH_
12 #include <openbabel/babelconfig.h>
13 #include <openbabel/mol.h>
14 #include <openbabel/obconversion.h>
40 static std::auto_ptr<OpenBabel::OBConversion>
converter;
61 converter.reset(
new OpenBabel::OBConversion(NULL,NULL));
63 converter->SetInAndOutFormats(
"CML",
"CAN");
67 std::stringstream molCML, outSMILES;
71 converter->Convert( &molCML, &outSMILES );
74 std::string out = outSMILES.str();
75 size_t from = out.find_first_not_of(
" \t\n");
76 assert(from != out.npos);
77 size_t to = out.find_last_not_of(
" \t\n");
78 assert(to != out.npos);
80 return out.substr(from, to-from+1);
87 std::auto_ptr<OpenBabel::OBConversion>