Main Page | Namespace List | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Examples

PDB.h

00001 /* Copyright 2004
00002 Stanford University
00003 
00004 This file is part of the DSR PDB Library.
00005 
00006 The DSR PDB Library is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU Lesser General Public License as published by
00008 the Free Software Foundation; either version 2.1 of the License, or (at your
00009 option) any later version.
00010 
00011 The DSR PDB Library is distributed in the hope that it will be useful, but
00012 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00013 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00014 License for more details.
00015 
00016 You should have received a copy of the GNU Lesser General Public License
00017 along with the DSR PDB Library; see the file COPYING.LIB.  If not, write to
00018 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00019 MA 02111-1307, USA. */
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