00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 00005 #ifndef BALL_FORMAT_KCFFILE_H 00006 #define BALL_FORMAT_KCFFILE_H 00007 00008 #ifndef BALL_FORMAT_GENERICMOLFILE_H 00009 # include <BALL/FORMAT/genericMolFile.h> 00010 #endif 00011 00012 #ifndef BALL_MATHS_VECTOR3_H 00013 # include <BALL/MATHS/vector3.h> 00014 #endif 00015 00016 namespace BALL 00017 { 00018 class System; 00019 class Atom; 00020 class Molecule; 00021 00027 class BALL_EXPORT KCFFile 00028 : public GenericMolFile 00029 { 00030 public: 00031 00034 static const char* ENTRY_TAG; 00035 static const char* NODE_TAG; 00036 static const char* EDGE_TAG; 00037 static const char* DELIMITER_TAG; 00038 static const char* CONTINUED_LINE; 00040 00043 typedef HashMap<const Atom*, Position> AtomIndexMap; 00044 typedef HashMap<Position, Atom*> IndexAtomMap; 00046 00050 00052 KCFFile(); 00053 00055 KCFFile(const String& filename, File::OpenMode open_mode = std::ios::in) 00056 throw(Exception::FileNotFound); 00057 00059 KCFFile(const KCFFile& file) throw(Exception::FileNotFound); 00060 00062 virtual ~KCFFile(); 00064 00068 00070 virtual bool write(const Molecule& molecule) throw(File::CannotWrite); 00071 00075 virtual bool write(const System& system) throw(File::CannotWrite); 00076 00081 virtual bool read(System& system) throw(Exception::ParseError); 00082 00086 virtual Molecule* read() throw(Exception::ParseError); 00087 00089 const KCFFile& operator = (const KCFFile& file); 00090 00092 00093 protected: 00094 00095 bool readENTRY_(Molecule& mol); 00096 bool readNODE_(Molecule& mol, IndexAtomMap& index_to_atom); 00097 bool readEDGE_(IndexAtomMap& index_to_atom); 00098 bool readDELIMITER_(); 00099 }; 00100 00101 } // namespace BALL 00102 00103 #endif // BALL_FORMAT_KCFFILE_H