1 /* -*- c++ -*- */ 2 #ifndef XYZTRAJECTORYREADER_H 3 #define XYZTRAJECTORYREADER_H 4 5 #include "Reader.h" 6 #include "XYZ.h" 7 8 namespace ProtoMol { 9 10 //_________________________________________________________________XYZTrajectoryReader 11 /** 12 * Reads a XYY trajectory files (ASCII). 13 */ 14 class XYZTrajectoryReader : public Reader { 15 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 16 // Constructors, destructors (both default here), assignment 17 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 public: 19 XYZTrajectoryReader(); 20 explicit XYZTrajectoryReader(const std::string& filename); 21 virtual ~XYZTrajectoryReader(); 22 23 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 24 // From class File 25 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 26 public: open()27 virtual bool open(){myFirst=true;return File::open();} open(const std::string & filename)28 virtual bool open(const std::string& filename){myFirst=true;return File::open(filename);} open(const char * filename)29 virtual bool open(const char* filename){myFirst=true;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 XYZ 40 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 41 public: 42 bool read(XYZ& xyz); 43 bool read(Vector3DBlock& coords, std::vector<std::string>& names); 44 45 XYZ getXYZ() const; 46 Vector3DBlock* orphanCoords(); 47 std::vector<std::string>* orphanNames(); 48 49 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 50 // Friends 51 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 52 public: 53 friend XYZTrajectoryReader& operator>>(XYZTrajectoryReader& xyzReader, XYZ& xyz); 54 friend XYZTrajectoryReader& operator>>(XYZTrajectoryReader& xyzReader, Vector3DBlock& coords); 55 56 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 57 // My data members 58 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 59 private: 60 Vector3DBlock* myCoords; 61 std::vector<std::string>* myNames; 62 bool myFirst; 63 }; 64 65 //____________________________________________________________________________INLINES 66 } 67 #endif /* XYZTRAJECTORYREADER_H */ 68