00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 00005 #ifndef BALL_FORMAT_GENERICMOLFILE_H 00006 #define BALL_FORMAT_GENERICMOLFILE_H 00007 00008 #ifndef BALL_FORMAT_LINEBASEDFILE_H 00009 # include <BALL/FORMAT/lineBasedFile.h> 00010 #endif 00011 00012 namespace BALL 00013 { 00014 class Atom; 00015 class System; 00016 class Molecule; 00017 00056 class BALL_EXPORT GenericMolFile 00057 : public LineBasedFile 00058 { 00059 public: 00060 00064 00067 GenericMolFile(); 00068 00071 GenericMolFile(const String& filename, File::OpenMode open_mode = std::ios::in) 00072 throw(Exception::FileNotFound); 00073 00076 virtual ~GenericMolFile(); 00077 00079 00082 00086 const GenericMolFile& operator = (const GenericMolFile& rhs) 00087 throw(Exception::FileNotFound); 00088 00090 00093 00102 virtual bool write(const System& system) 00103 throw(File::CannotWrite); 00104 00110 virtual bool write(const Molecule& molecule) 00111 throw(File::CannotWrite); 00112 00122 virtual bool read(System& system) 00123 throw(Exception::ParseError); 00124 00135 virtual Molecule* read() 00136 throw(Exception::ParseError); 00137 00139 00142 00146 virtual GenericMolFile& operator >> (System& system) 00147 throw(Exception::ParseError); 00148 00152 virtual GenericMolFile& operator << (const System& system) 00153 throw(File::CannotWrite); 00154 00158 virtual GenericMolFile& operator >> (Molecule& molecule) 00159 throw(Exception::ParseError); 00160 00164 virtual GenericMolFile& operator << (const Molecule& molecule) 00165 throw(File::CannotWrite); 00167 00168 protected: 00176 virtual void initRead_(); 00177 00182 virtual void initWrite_(); 00183 00184 }; 00185 } // namespace BALL 00186 00187 #endif // BALL_FORMAT_GENERICMOLFILE_H