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 00053 KCFFile(); 00054 00058 KCFFile(const String& filename, File::OpenMode open_mode = std::ios::in); 00059 00062 virtual ~KCFFile(); 00064 00068 00072 virtual bool write(const Molecule& molecule); 00073 00078 virtual bool write(const System& system); 00079 00085 virtual bool read(System& system); 00086 00091 virtual Molecule* read(); 00092 00094 const KCFFile& operator = (const KCFFile& file); 00095 00097 00098 protected: 00099 00100 bool readENTRY_(Molecule& mol); 00101 bool readNODE_(Molecule& mol, IndexAtomMap& index_to_atom); 00102 bool readEDGE_(IndexAtomMap& index_to_atom); 00103 bool readDELIMITER_(); 00104 }; 00105 00106 } // namespace BALL 00107 00108 #endif // BALL_FORMAT_KCFFILE_H