00001
00002
00003
00004
00005 #ifndef BALL_FORMAT_GAMESSDATFILE_H
00006 #define BALL_FORMAT_GAMESSDATFILE_H
00007
00008 #ifndef BALL_FORMAT_GENERICMOLFILE_H
00009 # include <BALL/FORMAT/genericMolFile.h>
00010 #endif
00011
00012 #ifndef BALL_DATATYPE_STRINGHASHMAP_H
00013 # include <BALL/DATATYPE/stringHashMap.h>
00014 #endif
00015 namespace BALL
00016 {
00023 class BALL_EXPORT GAMESSDatFile
00024 : public GenericMolFile
00025 {
00026 public:
00027
00029 class block
00030 {
00031 public:
00033 String blockname;
00035 StringHashMap<String> data;
00036
00037 void operator >> (std::ostream& os) const;
00038
00039 };
00040
00042 struct State
00043 {
00044 GAMESSDatFile* current_parser;
00045 };
00046
00050
00053 GAMESSDatFile();
00054
00057 GAMESSDatFile(const String& filename, File::OpenMode open_mode = std::ios::in)
00058 throw(Exception::FileNotFound);
00059
00062 virtual ~GAMESSDatFile();
00063
00065
00068
00071 const GAMESSDatFile& operator = (const GAMESSDatFile& rhs)
00072 throw(Exception::FileNotFound);
00073
00075
00079
00084 virtual bool write(const Molecule& molecule)
00085 throw(File::CannotWrite);
00086
00091 virtual bool write(const System& molecule)
00092 throw(File::CannotWrite);
00093
00098 virtual Molecule* read()
00099 throw(Exception::ParseError);
00100
00105 virtual bool read(System& system)
00106 throw(Exception::ParseError);
00107
00109
00113 void newMolecule();
00114
00115 void setMoleculeName(char* name);
00116
00117 void insertAtom(char* element, float charge, float x, float y, float z);
00118
00119 void insertBond(Index a1, Index a2);
00120
00121 void inBlock(const char* blockname);
00122
00123 void insertBlockedData(const char* key, const char* value);
00124
00125 void insertBlockedData(const String& key, const String& value);
00126
00127 String& getBlockedData(const String& block, const String& key);
00128
00129 const String& getBlockedData(const String& block, const String& key) const;
00130
00131 void clearParameters();
00133
00134 static State state;
00135
00136 protected:
00137 virtual void initRead_();
00138
00139 Molecule* molecule_;
00140
00141 String current_block_;
00142 StringHashMap<block> blocks_;
00143 String symmetry_group_;
00144 };
00145 }
00146
00147 #endif // BALL_FORMAT_GAMESSDATFILE_H