00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_IO_ENTITY_IO_PLUGIN_MAE_H
00020 #define OST_IO_ENTITY_IO_PLUGIN_MAE_H
00021
00022 #include <ost/mol/entity_handle.hh>
00023 #include <ost/mol/chain_handle.hh>
00024 #include <ost/mol/residue_handle.hh>
00025 #include <ost/io/mol/entity_io_handler.hh>
00026
00027 #include <boost/iostreams/filtering_stream.hpp>
00028 #include <boost/filesystem/fstream.hpp>
00029
00030 namespace ost { namespace io {
00031
00032 class DLLEXPORT_OST_IO MAEReader {
00033 public:
00034 MAEReader(const boost::filesystem::path& loc);
00035
00036 void Import(mol::EntityHandle& ent);
00037
00038 private:
00039
00040 void parse_and_add_atom(mol::EntityHandle ent,
00041 mol::XCSEditor& editor,
00042 char* line,
00043 size_t line_len,
00044 int i_atom_name,
00045 int i_atom_xpos,
00046 int i_atom_ypos,
00047 int i_atom_zpos,
00048 int i_res_name,
00049 int i_res_num,
00050 int i_chain_name);
00051
00052 mol::ChainHandle curr_chain_;
00053 mol::ResidueHandle curr_residue_;
00054 int chain_count_;
00055 int residue_count_;
00056 int atom_count_;
00057 boost::filesystem::ifstream infile_;
00058 boost::iostreams::filtering_stream<boost::iostreams::input> in_;
00059 };
00060
00061 class DLLEXPORT_OST_IO EntityIOMAEHandler: public EntityIOHandler {
00062 public:
00063 virtual void Import(mol::EntityHandle& ent, const boost::filesystem::path& loc);
00064
00065 virtual void Export(const mol::EntityView& ent,
00066 const boost::filesystem::path& loc) const;
00067
00068 virtual void Import(mol::EntityHandle& ent, std::istream& stream);
00069
00070 virtual void Export(const mol::EntityView& ent, std::ostream& stream) const;
00071
00072 static bool ProvidesImport(const boost::filesystem::path& loc,
00073 const String& format="auto");
00074 static bool ProvidesExport(const boost::filesystem::path& loc,
00075 const String& format="auto");
00076 virtual bool RequiresProcessor() const;
00077
00078 static String GetFormatName() { return String("Mae"); }
00079 static String GetFormatDescription() { return String("MAEstro coordinate file format"); }
00080 };
00081
00082
00083 typedef EntityIOHandlerFactory<EntityIOMAEHandler> EntityIOMAEHandlerFactory;
00084
00085 mol::EntityHandle DLLEXPORT_OST_IO LoadMAE(const String& file_name);
00086
00087 }}
00088
00089 #endif