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