00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 // $Id: KCFFile.h,v 1.2 2005/12/23 17:01:44 amoll Exp $ 00005 // 00006 00007 #ifndef BALL_FORMAT_KCFFILE_H 00008 #define BALL_FORMAT_KCFFILE_H 00009 00010 #ifndef BALL_FORMAT_GENERICMOLFILE_H 00011 # include <BALL/FORMAT/genericMolFile.h> 00012 #endif 00013 00014 #ifndef BALL_MATHS_VECTOR3_H 00015 # include <BALL/MATHS/vector3.h> 00016 #endif 00017 00018 namespace BALL 00019 { 00020 class System; 00021 class Atom; 00022 class Molecule; 00023 00029 class BALL_EXPORT KCFFile 00030 : public GenericMolFile 00031 { 00032 public: 00033 00034 BALL_CREATE(KCFFile) 00035 00036 00037 00039 static const char* ENTRY_TAG; 00040 static const char* NODE_TAG; 00041 static const char* EDGE_TAG; 00042 static const char* DELIMITER_TAG; 00043 static const char* CONTINUED_LINE; 00045 00048 typedef HashMap<const Atom*, Position> AtomIndexMap; 00049 typedef HashMap<Position, Atom*> IndexAtomMap; 00051 00055 00057 KCFFile() ; 00058 00060 KCFFile(const String& filename, File::OpenMode open_mode = std::ios::in) 00061 throw(Exception::FileNotFound); 00062 00064 KCFFile(const KCFFile& file) throw(Exception::FileNotFound); 00065 00067 virtual ~KCFFile() ; 00069 00073 00075 virtual bool write(const Molecule& molecule) throw(File::CannotWrite); 00076 00080 virtual bool write(const System& system) throw(File::CannotWrite); 00081 00086 virtual bool read(System& system) throw(Exception::ParseError); 00087 00091 virtual Molecule* read() throw(Exception::ParseError); 00092 00094 const KCFFile& operator = (const KCFFile& file) 00095 ; 00096 00098 00099 protected: 00100 00101 bool readENTRY_(Molecule& mol); 00102 bool readNODE_(Molecule& mol, IndexAtomMap& index_to_atom); 00103 bool readEDGE_(IndexAtomMap& index_to_atom); 00104 bool readDELIMITER_(); 00105 }; 00106 00107 } // namespace BALL 00108 00109 #endif // BALL_FORMAT_KCFFILE_H