1 /* -*- c++ -*- */ 2 #ifndef PDBREADER_H 3 #define PDBREADER_H 4 5 #include "Reader.h" 6 #include "PDB.h" 7 #include "XYZ.h" 8 9 namespace ProtoMol { 10 11 //_________________________________________________________________PDBReader 12 /** 13 * Reads a PDB (ASCII) file, ATOM record only. 14 */ 15 class PDBReader : public Reader { 16 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 17 // Constructors, destructors (both default here), assignment 18 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 19 public: 20 PDBReader(); 21 explicit PDBReader(const std::string& filename); 22 virtual ~PDBReader(); 23 24 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 // From class File 26 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 27 public: open()28 virtual bool open(){return File::open();} open(const std::string & filename)29 virtual bool open(const std::string& filename){return File::open(filename);} open(const char * filename)30 virtual bool open(const char* filename){return File::open(filename);} 31 32 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 33 // From class Reader 34 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 public: 36 virtual bool tryFormat(); 37 virtual bool read(); 38 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 39 // New methods of class PDB 40 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 41 public: 42 bool read(PDB& pdb); 43 bool read(Vector3DBlock& coords, std::vector<PDB::PDBAtom>& atoms); 44 45 PDB getPDB() const; 46 Vector3DBlock* orphanCoords(); 47 std::vector<PDB::PDBAtom>* orphanAtoms(); 48 49 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 50 // Friends 51 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 52 public: 53 friend PDBReader& operator>>(PDBReader& pdbReader, PDB& pdb); 54 friend PDBReader& operator>>(PDBReader& pdbReader, XYZ& xyz); 55 friend PDBReader& operator>>(PDBReader& pdbReader, Vector3DBlock& coords); 56 57 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 58 // My data members 59 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 60 private: 61 Vector3DBlock* myCoords; 62 std::vector<PDB::PDBAtom>* myAtoms; 63 }; 64 65 //____________________________________________________________________________INLINES 66 67 } 68 #endif /* PDBREADER_H */ 69