/* * TremoloParser.hpp * * Created on: Mar 2, 2010 * Author: metzler */ #ifndef TREMOLOPARSER_HPP_ #define TREMOLOPARSER_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include "Parser/FormatParser.hpp" #include "TremoloKey.hpp" #include "TremoloAtomInfoContainer.hpp" class molecule; /** * Loads a tremolo file into the World and saves the World as a tremolo file. */ class TremoloParser : public FormatParser { public: TremoloParser(); ~TremoloParser(); void load(std::istream* file); void save(std::ostream* file, const std::vector &atoms); void setFieldsForSave(std::string atomDataLine); private: void readAtomDataLine(string line); void readAtomDataLine(string line, molecule *newmol); void parseAtomDataKeysLine(string line, int offset); void readNeighbors(std::stringstream* line, int numberOfNeighbors, int atomId); void processNeighborInformation(); void adaptImprData(); void adaptTorsion(); std::string adaptIdDependentDataString(std::string data); bool isUsedField(std::string fieldName); void writeNeighbors(std::ostream* file, int numberOfNeighbors, atom* currentAtom); void saveLine(std::ostream* file, atom* currentAtom); /** * Map to associate the known keys with numbers. */ std::map knownKeys; /** * Fields used in the tremolo file. */ std::vector usedFields; /** * Data which is currently not stored in atoms but was provided by the input * file. */ std::map additionalAtomData; /** * Default additional atom data. */ TremoloAtomInfoContainer defaultAdditionalData; /** * Maps original atom IDs received from the parsed file to atom IDs in the * world. */ std::map atomIdMap; }; #endif /* TREMOLOPARSER_HPP_ */