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/io/mol/entity_io_handler.hh>
00023
00024 #include <boost/iostreams/filtering_stream.hpp>
00025 #include <boost/filesystem/fstream.hpp>
00026
00027 namespace ost { namespace io {
00028
00029 class DLLEXPORT_OST_IO MAEReader {
00030 public:
00031 MAEReader(const boost::filesystem::path& loc);
00032
00033 void Import(mol::EntityHandle& ent);
00034
00035 private:
00036
00037 void add_atom(mol::EntityHandle ent,
00038 mol::XCSEditor& editor,const std::string& s_aname,
00039 const std::string& s_axpos,
00040 const std::string& s_aypos,
00041 const std::string& s_azpos,
00042 const std::string& s_rname,
00043 const std::string& s_rnum,
00044 const std::string& s_cname);
00045
00046 mol::ChainHandle curr_chain_;
00047 mol::ResidueHandle curr_residue_;
00048 int chain_count_;
00049 int residue_count_;
00050 int atom_count_;
00051 boost::filesystem::ifstream infile_;
00052 boost::iostreams::filtering_stream<boost::iostreams::input> in_;
00053 };
00054
00055 class DLLEXPORT_OST_IO EntityIOMAEHandler: public EntityIOHandler {
00056 public:
00057 virtual void Import(mol::EntityHandle& ent, const boost::filesystem::path& loc);
00058
00059 virtual void Export(const mol::EntityView& ent,
00060 const boost::filesystem::path& loc) const;
00061
00062 virtual void Import(mol::EntityHandle& ent, std::istream& stream);
00063
00064 virtual void Export(const mol::EntityView& ent, std::ostream& stream) const;
00065
00066 static bool ProvidesImport(const boost::filesystem::path& loc,
00067 const String& format="auto");
00068 static bool ProvidesExport(const boost::filesystem::path& loc,
00069 const String& format="auto");
00070 virtual bool RequiresBuilder() const;
00071
00072 static String GetFormatName() { return String("Mae"); }
00073 static String GetFormatDescription() { return String("MAEstro coordinate file format"); }
00074 };
00075
00076
00077 typedef EntityIOHandlerFactory<EntityIOMAEHandler> EntityIOMAEHandlerFactory;
00078
00079 mol::EntityHandle DLLEXPORT_OST_IO LoadMAE(const String& file_name);
00080
00081 }}
00082
00083 #endif
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 #ifndef OST_IO_ENTITY_IO_PLUGIN_MAE_H
00103 #define OST_IO_ENTITY_IO_PLUGIN_MAE_H
00104
00105 #include <ost/io/mol/entity_io_handler.hh>
00106
00107 #include <boost/iostreams/filtering_stream.hpp>
00108 #include <boost/filesystem/fstream.hpp>
00109
00110 namespace ost { namespace io {
00111
00112 class DLLEXPORT_OST_IO MAEReader {
00113 public:
00114 MAEReader(const boost::filesystem::path& loc);
00115
00116 void Import(mol::EntityHandle& ent);
00117
00118 private:
00119
00120 void add_atom(mol::EntityHandle ent,
00121 mol::XCSEditor& editor,const std::string& s_aname,
00122 const std::string& s_axpos,
00123 const std::string& s_aypos,
00124 const std::string& s_azpos,
00125 const std::string& s_rname,
00126 const std::string& s_rnum,
00127 const std::string& s_cname);
00128
00129 mol::ChainHandle curr_chain_;
00130 mol::ResidueHandle curr_residue_;
00131 int chain_count_;
00132 int residue_count_;
00133 int atom_count_;
00134 boost::filesystem::ifstream infile_;
00135 boost::iostreams::filtering_stream<boost::iostreams::input> in_;
00136 };
00137
00138 class DLLEXPORT_OST_IO EntityIOMAEHandler: public EntityIOHandler {
00139 public:
00140 virtual void Import(mol::EntityHandle& ent, const boost::filesystem::path& loc);
00141
00142 virtual void Export(const mol::EntityView& ent,
00143 const boost::filesystem::path& loc) const;
00144
00145 virtual void Import(mol::EntityHandle& ent, std::istream& stream);
00146
00147 virtual void Export(const mol::EntityView& ent, std::ostream& stream) const;
00148
00149 static bool ProvidesImport(const boost::filesystem::path& loc,
00150 const String& format="auto");
00151 static bool ProvidesExport(const boost::filesystem::path& loc,
00152 const String& format="auto");
00153 virtual bool RequiresBuilder() const;
00154
00155 static String GetFormatName() { return String("Mae"); }
00156 static String GetFormatDescription() { return String("MAEstro coordinate file format"); }
00157 };
00158
00159
00160 typedef EntityIOHandlerFactory<EntityIOMAEHandler> EntityIOMAEHandlerFactory;
00161
00162 mol::EntityHandle DLLEXPORT_OST_IO LoadMAE(const String& file_name);
00163
00164 }}
00165
00166 #endif