00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_IO_PDB_WRITER_HH
00020 #define OST_IO_PDB_WRITER_HH
00021
00022
00023
00024
00025
00026 #include <fstream>
00027
00028 #include <boost/filesystem/fstream.hpp>
00029 #include <boost/iostreams/filtering_stream.hpp>
00030
00031 #include <ost/io/module_config.hh>
00032 #include <ost/io/formatted_line.hh>
00033 #include <ost/io/mol/io_profile.hh>
00034
00035 namespace ost {
00036
00037 namespace mol {
00038
00039 class EntityView;
00040 class EntityHandle;
00041
00042 }
00043
00044 namespace io {
00045
00046
00047 class DLLEXPORT_OST_IO PDBWriter {
00048 typedef boost::iostreams::filtering_stream<boost::iostreams::output> OutStream;
00049 public:
00050 PDBWriter(const String& filename,
00051 const IOProfile& profile);
00052 PDBWriter(const boost::filesystem::path& filename,
00053 const IOProfile& profile);
00054 PDBWriter(std::ostream& outstream, const IOProfile& profile);
00055 void SetWriteMultiModel(bool flag) { multi_model_=flag; }
00056 bool GetWriteMultiModel() const { return multi_model_; }
00057 void SetIsPQR(bool flag) { is_pqr_=flag; }
00058 bool IsPQR() const { return is_pqr_; }
00059 void Write(const mol::EntityView& ent);
00060 void Write(const mol::EntityHandle& ent);
00061
00062 void Write(const mol::AtomHandleList& atoms);
00063
00064 ~PDBWriter();
00065 private:
00066 template <typename H>
00067 void WriteModel(H ent);
00068
00069 void WriteModelLeader();
00070 void WriteModelTrailer();
00071 std::ofstream outfile_;
00072 std::ostream& outstream_;
00073 int mol_count_;
00074 std::map<long, int> atom_indices_;
00075 FormattedLine line_;
00076 bool multi_model_;
00077 bool charmm_style_;
00078 bool is_pqr_;
00079 IOProfile profile_;
00080 String filename_;
00081 OutStream out_;
00082 };
00083
00084 }}
00085
00086 #endif