Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

structure_file_reader.h

Go to the documentation of this file.
00001 // -*- mode: c++; -*-
00002 //
00003 //The Biomolecule Toolkit (BTK) is a C++ library for use in the
00004 //modeling, analysis, and design of biological macromolecules.
00005 //Copyright (C) 2001, Tim Robertson <kid50@users.sourceforge.net>
00006 //
00007 //This program is free software; you can redistribute it and/or modify
00008 //it under the terms of the GNU Lesser General Public License as published
00009 //by the Free Software Foundation; either version 2.1 of the License, or (at
00010 //your option) any later version.
00011 //
00012 //This program is distributed in the hope that it will be useful,  but
00013 //WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 //Lesser General Public License for more details. 
00016 //
00017 //You should have received a copy of the GNU Lesser General Public License 
00018 //along with this program; if not, write to the Free Software Foundation, 
00019 //Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020 
00025 #ifndef STRUCTURE_FILE_READER_H
00026 #define STRUCTURE_FILE_READER_H
00027 
00028 #include <string>
00029 #include <vector>
00030 #include <exception>
00031 #include <memory>
00032 #include <iosfwd>
00033 
00034 namespace BTK {
00035 
00036 // Forward declaration(s).
00037 class PDBAtom;
00038   
00046 class StructureFileReader
00047 {
00048   public:
00049 
00051   class StructureFileReadFailure : public std::exception
00052   {
00053   public:
00054     StructureFileReadFailure(char const * what = "");
00055     virtual char const * what() const throw();
00056   private:
00057     char const * _what;
00058   };
00059 
00060   typedef std::vector<PDBAtom> chain_type;
00061 
00065   StructureFileReader(std::string const & filename);
00066 
00070   StructureFileReader(std::istream & stream);
00071   
00073   virtual ~StructureFileReader() = 0;
00074 
00076   virtual std::string get_header() = 0;
00077   
00079   virtual std::vector<char> get_chain_ids() = 0;
00080 
00086   virtual std::auto_ptr<chain_type> get_chain(char const id = ' ') = 0;
00087 
00089   virtual std::auto_ptr<chain_type> get_next_chain() = 0;
00090   
00091   protected:
00092 
00094   std::istream & stream() { return *_stream; }
00095 
00096   private:
00097   std::istream *_stream;
00098   bool _locally_allocated;
00099   
00100   // Disallow default copy construction and assignment operator
00101   StructureFileReader(StructureFileReader const & source);
00102   StructureFileReader & operator=(StructureFileReader const & source);
00103 };
00104 
00105 // This typedef eliminates the potential hiding of class StructureFileReader
00106 // with a function named StructureFileReader
00107 typedef class StructureFileReader StructureFileReader;
00108 
00109 } // namespace BTK
00110 
00111 #endif // STRUCTURE_FILE_READER_H

Generated on Wed Apr 14 00:43:18 2004 for BTK by doxygen 1.3.6