00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OB_MOLECULEFORMAT_H
00020 #define OB_MOLECULEFORMAT_H
00021
00022 #ifdef _WIN32
00023 #include <hash_map>
00024 #endif
00025
00026 #include <openbabel/mol.h>
00027 #include <openbabel/obconversion.h>
00028
00029 namespace OpenBabel {
00030
00031
00032
00033 #ifndef OBCOMMON
00034 #define OBCOMMON
00035 #endif
00036
00050 class OBCOMMON OBMoleculeFormat : public OBFormat
00051 {
00052 private:
00053 static std::map<std::string, OBMol*> IMols;
00054 static OBMol* _jmol;
00055 static std::vector<OBMol> MolArray;
00056 static bool StoredMolsReady;
00057
00058 public:
00059
00060 OBMoleculeFormat()
00061 {
00062 OBConversion::RegisterOptionParam("b", this, 0, OBConversion::INOPTIONS);
00063 OBConversion::RegisterOptionParam("s", this, 0, OBConversion::INOPTIONS);
00064 OBConversion::RegisterOptionParam("title", this, 1,OBConversion::GENOPTIONS);
00065 OBConversion::RegisterOptionParam("addtotitle", this, 1,OBConversion::GENOPTIONS);
00066 OBConversion::RegisterOptionParam("property", this, 2, OBConversion::GENOPTIONS);
00067 OBConversion::RegisterOptionParam("C", this, 0,OBConversion::GENOPTIONS);
00068 OBConversion::RegisterOptionParam("j", this, 0,OBConversion::GENOPTIONS);
00069 OBConversion::RegisterOptionParam("join", this, 0,OBConversion::GENOPTIONS);
00070 OBConversion::RegisterOptionParam("separate", this, 0,OBConversion::GENOPTIONS);
00071
00072
00073
00074
00075
00076 OBConversion::RegisterOptionParam("s", NULL, 1,OBConversion::GENOPTIONS);
00077 OBConversion::RegisterOptionParam("v", NULL, 1,OBConversion::GENOPTIONS);
00078 OBConversion::RegisterOptionParam("h", NULL, 0,OBConversion::GENOPTIONS);
00079 OBConversion::RegisterOptionParam("d", NULL, 0,OBConversion::GENOPTIONS);
00080 OBConversion::RegisterOptionParam("b", NULL, 0,OBConversion::GENOPTIONS);
00081 OBConversion::RegisterOptionParam("c", NULL, 0,OBConversion::GENOPTIONS);
00082 OBConversion::RegisterOptionParam("p", NULL, 0,OBConversion::GENOPTIONS);
00083 OBConversion::RegisterOptionParam("t", NULL, 0,OBConversion::GENOPTIONS);
00084 OBConversion::RegisterOptionParam("k", NULL, 0,OBConversion::GENOPTIONS);
00085 };
00086
00088 static bool ReadChemObjectImpl(OBConversion* pConv, OBFormat*);
00090 static bool WriteChemObjectImpl(OBConversion* pConv, OBFormat*);
00091
00093 virtual bool ReadChemObject(OBConversion* pConv)
00094 { return ReadChemObjectImpl(pConv, this);}
00095
00097 virtual bool WriteChemObject(OBConversion* pConv)
00098 { return WriteChemObjectImpl(pConv, this);}
00099
00101
00102
00103
00104 static bool DeferMolOutput(OBMol* pmol, OBConversion* pConv, OBFormat* pF);
00106 static bool OutputDeferredMols(OBConversion* pConv);
00108 static bool DeleteDeferredMols();
00110 static OBMol* MakeCombinedMolecule(OBMol* pFirst, OBMol* pSecond);
00112
00113 #ifdef _WIN32
00114 typedef stdext::hash_map<std::string, unsigned> NameIndexType;
00115 #else
00116 typedef std::map<std::string, unsigned> NameIndexType;
00117 #endif
00118
00119
00120 static bool ReadNameIndex(NameIndexType& index, const std::string& datafilename,
00121 OBFormat* pInFormat);
00122
00124 const std::type_info& GetType()
00125 {
00126 return typeid(OBMol*);
00127 }
00129
00130 };
00131
00132 }
00133 #endif //OB_MOLECULEFORMAT_H
00134