MTK++ Latest version: 0.2.0

mtkppParser.h
Go to the documentation of this file.
00001 
00035 #ifndef MTKPPPARSER_H
00036 #define MTKPPPARSER_H
00037 
00038 #include <vector>
00039 #include <map>
00040 
00041 #include <iostream>
00042 #include <string>
00043 #include <fstream>
00044 #include <iomanip>
00045 #include <stdlib.h>
00046 #include <stdio.h>
00047 #include <ctype.h>
00048 
00049 #include "Utils/constants.h"
00050 #include "baseParser.h"
00051 
00052 #ifdef USE_QT
00053 #include <QtCore>
00054 #include <QtXml>
00055 #elif defined(USE_XERCES)
00056 #include "domErrorHandler.h"
00057 #else // USE_TINYXML
00058 #include <sstream>
00059 #include "tinyxml/tinyxml.h"
00060 #endif
00061 
00062 namespace MTKpp
00063 {
00064 
00065 class collection;
00066 class molecule;
00067 class submolecule;
00068 class atom;
00069 class vector3d;
00070 struct Bond;
00071 struct Angle;
00072 struct Torsion;
00073 struct Improper;
00074 class metalCenter;
00075 
00076 // ============================================================
00077 // Class : mtkppParser()
00078 // ------------------------------------------------------------
00084 // ============================================================
00085 
00086 #ifdef USE_QT
00087 class mtkppParser : public QObject, public baseParser
00088 {
00089     Q_OBJECT
00090 
00091 #else // USE_XERCES and USE_TINYXML
00092 class mtkppParser : public baseParser
00093 {
00094 #endif
00095 
00096 friend class stdLibParser;
00097 
00098 public:
00102     mtkppParser();
00103 
00105     virtual ~mtkppParser();
00106 
00112     void           Read(const std::string &i, collection* c);
00113 
00119     void           Write(const std::string &o, collection* c);
00120 
00121 
00122 #ifdef USE_QT
00123 
00129     void readMolecule(QDomNode node, molecule* mol);
00130 
00131 protected: // functions
00132 
00138     void readSubmolecule(QDomNode node, molecule* mol);
00139 
00145     void readAtom(QDomNode node, submolecule* subMol);
00146 
00152     void readBond(QDomNode node, molecule* mol);
00153 
00159     void readAngle(QDomNode node, molecule* mol);
00160 
00166     void readTorsion(QDomNode node, molecule* mol);
00167 
00173     void writeMolecule(QDomDocument doc, molecule* mol);
00174 
00181     void writeMolecule(QDomDocument doc, QDomElement groupElem, molecule* mol);
00182 
00189     void writeSubMolecule(QDomDocument doc, QDomElement moleculeElem, submolecule* smol);
00190 
00198     void writeAtom(QDomDocument doc, QDomElement smolElem, submolecule* smol, atom* at);
00199 
00206     void writeBonds(QDomDocument doc, QDomElement moleculeElem, std::map<int, Bond*> bonds);
00207 
00214     void writeAngles(QDomDocument doc, QDomElement moleculeElem, std::map<ULONG_KIND, Angle*> angles);
00215 
00222     void writeTorsions(QDomDocument doc, QDomElement moleculeElem, std::map<ULONG_KIND, Torsion*> torsions);
00223 
00224 #elif defined(USE_XERCES)
00225 
00231     void readMolecule(DOMNode* molNode, molecule* mol);
00232 
00233 protected: // functions
00234 
00235     // todo
00241     void readSubmolecule(DOMNode* smolNode, molecule* mol);
00242 
00248     void readAtom(DOMNode* atomNode, submolecule* subMol);
00249 
00255     void readBond(DOMNode* bondNode, molecule* mol);
00256 
00262     void readAngle(DOMNode* angleNode, molecule* mol);
00263 
00269     void readTorsion(DOMNode* torNode, molecule* mol);
00270 
00276     void writeMolecule(XERCES_CPP_NAMESPACE::DOMDocument* doc, molecule* mol);
00277 
00284     void writeSubMolecule(XERCES_CPP_NAMESPACE::DOMDocument* doc, DOMElement* moleculeElem, submolecule* smol);
00285 
00293     void writeAtom(XERCES_CPP_NAMESPACE::DOMDocument* doc, DOMElement* smolElem, submolecule* smol, atom* at);
00294 
00300     void writeMetalCenter(XERCES_CPP_NAMESPACE::DOMDocument* doc, metalCenter* pMetalCenter);
00301 
00308     void writeBonds(XERCES_CPP_NAMESPACE::DOMDocument* doc, DOMElement* moleculeElem, std::map<int, Bond*> bonds);
00309 
00316     void writeAngles(XERCES_CPP_NAMESPACE::DOMDocument* doc, DOMElement* moleculeElem, std::map<ULONG_KIND, Angle*> angles);
00317 
00324     void writeTorsions(XERCES_CPP_NAMESPACE::DOMDocument* doc, DOMElement* moleculeElem, std::map<ULONG_KIND, Torsion*> torsions);
00325 
00326 #else // USE_TINYXML
00327 
00332     void readMolecule(TiXmlNode* molNode, molecule* mol);
00333 
00334 protected: // functions
00335 
00341     void readSubmolecule(TiXmlNode* smolNode , molecule* mol);
00342 
00348     void readAtom(TiXmlNode* atomNode, submolecule* subMol);
00349 
00355     void readBond(TiXmlNode* bondNode, molecule* mol);
00356 
00362     void readAngle(TiXmlNode* angleNode, molecule* mol);
00363 
00369     void readTorsion(TiXmlNode* torNode, molecule* mol);
00370 
00376     void writeMolecule(TiXmlElement* root, molecule* mol);
00377 
00383     void writeSubMolecule(TiXmlElement* root, submolecule* smol);
00384 
00391     void writeAtom(TiXmlElement* root, submolecule* smol, atom* at);
00392 
00398     void writeMetalCenter(TiXmlElement* root, metalCenter* pMetalCenter);
00399 
00405     void writeBonds(TiXmlElement* root, std::map<int, Bond*> bonds);
00406 
00412     void writeAngles(TiXmlElement* root, std::map<ULONG_KIND, Angle*> angles);
00413 
00419     void writeTorsions(TiXmlElement* root, std::map<ULONG_KIND, Torsion*> torsions);
00420 
00421 #endif // USE_QT/USE_XERCES
00422 
00423 protected: // data
00424 
00426     // - pointers to the backbone objects - //
00428 
00430     collection*    pCollection;
00431 
00433     atom*          pAtom;
00434 
00436     atom*          pAtom1;
00437 
00439     atom*          pAtom2;
00440 
00442     Bond*          pBond;
00443 
00445     Angle*         pAngle;
00446 
00448     Torsion*       pTorsion;
00449 
00451     Improper*      pImproper;
00452 
00454     vector3d*      pCoord1;
00455 
00457     vector3d*      pCoord2;
00458 
00460     typedef std::vector<molecule*>::iterator          moleculeIterator;
00461 
00463     typedef std::vector<submolecule*>::iterator       submoleculeIterator;
00464 
00466     typedef std::vector<atom*>::iterator              atomIterator;
00467 
00469     typedef std::map<int, Bond*>::iterator            BondMapIterator;
00470 
00472     typedef std::map<ULONG_KIND, Angle*>::iterator    AngleMapIterator;
00473 
00475     typedef std::map<ULONG_KIND, Torsion*>::iterator  TorsionMapIterator;
00476 
00478     typedef std::map<int, Improper*>::iterator        ImproperMapIterator;
00479 
00481     typedef std::map<std::string, double>::iterator   PropertyMapIterator;
00482 
00484     typedef std::map<std::string, int>::iterator      intPropertyMapIterator;
00485 };
00486 
00487 } // MTKpp namespace
00488 
00489 #endif // MTKPPPARSER_H

Generated on Fri Dec 23 2011 09:28:51 for MTK++ by Doxygen 1.7.5.1