00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef OST_IO_SDF_READER_HH
00023 #define OST_IO_SDF_READER_HH
00024
00025 #include <boost/filesystem/fstream.hpp>
00026 #include <ost/mol/mol.hh>
00027 #include <ost/io/module_config.hh>
00028
00029 namespace ost { namespace io {
00030
00031 class DLLEXPORT_OST_IO SDFReader {
00032 public:
00033 SDFReader(const String& filename);
00034 SDFReader(const boost::filesystem::path& loc);
00035 SDFReader(std::istream& instream);
00036
00037 bool HasNext();
00038
00039 void Import(mol::EntityHandle& ent);
00040
00041 private:
00042 void ClearState();
00043 void NextMolecule();
00044
00045 void ParseAndAddHeader(const String& line, int line_num, mol::EntityHandle& ent,
00046 mol::XCSEditor& editor);
00047
00048 void ParseAndAddAtom(const String& line, int line_num, mol::EntityHandle& ent,
00049 bool hetatm, mol::XCSEditor& editor);
00050
00051 void ParseAndAddBond(const String& line, int line_num, mol::EntityHandle& ent,
00052 mol::XCSEditor& editor);
00053
00054 mol::ChainHandle curr_chain_;
00055 mol::ResidueHandle curr_residue_;
00056 int chain_count_;
00057 int residue_count_;
00058 int atom_count_;
00059 int bond_count_;
00060 int line_num;
00061 boost::filesystem::ifstream infile_;
00062 std::istream& instream_;
00063 };
00064
00065 }}
00066
00067 #endif