00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef DSR_PDB_H
00022 #define DSR_PDB_H
00023
00024 #include <dsrpdb/Model.h>
00025 #include <iostream>
00026 #include <vector>
00027
00028
00030
00031 namespace dsrpdb {
00033
00036 class PDB {
00037 public:
00039
00042 PDB(std::istream &in, bool print_errors=false);
00044 PDB();
00045 ~PDB();
00046
00048 void write(std::ostream &out) const;
00049
00051 const Model &model(unsigned int i) const;
00053 Model &model(unsigned int i);
00055 void new_model(const Model &m);
00057 size_t number_of_models() const;
00058
00059 typedef std::vector<std::string>::const_iterator Header_iterator;
00061 Header_iterator header_begin() const;
00063 Header_iterator header_end() const;
00064
00066 template <class It>
00067 void set_header(It b, It e){
00068 header_.clear();
00069 header_.insert(header_.end(), b,e);
00070 }
00071
00073 typedef std::vector<Model>::const_iterator Const_models_iterator;
00075 typedef std::vector<Model>::iterator Models_iterator;
00076
00077 Const_models_iterator models_begin() const {
00078 return models_.begin();
00079 }
00080 Const_models_iterator models_end() const {
00081 return models_.end();
00082 }
00083 Models_iterator models_begin() {
00084 return models_.begin();
00085 }
00086 Models_iterator models_end() {
00087 return models_.end();
00088 }
00089 protected:
00090 void load(std::istream &in, bool print_errors);
00091
00092 std::vector<std::string> header_;
00093 std::vector<Model> models_;
00094 };
00095 };
00096 #endif