1 /* massXpert - the true massist's program. 2 -------------------------------------- 3 Copyright(C) 2006,2007 Filippo Rusconi 4 5 http://www.massxpert.org/massXpert 6 7 This file is part of the massXpert project. 8 9 The massxpert project is the successor to the "GNU polyxmass" 10 project that is an official GNU project package(see 11 www.gnu.org). The massXpert project is not endorsed by the GNU 12 project, although it is released ---in its entirety--- under the 13 GNU General Public License. A huge part of the code in massXpert 14 is actually a C++ rewrite of code in GNU polyxmass. As such 15 massXpert was started at the Centre National de la Recherche 16 Scientifique(FRANCE), that granted me the formal authorization to 17 publish it under this Free Software License. 18 19 This software is free software; you can redistribute it and/or 20 modify it under the terms of the GNU General Public 21 License version 3, as published by the Free Software Foundation. 22 23 24 This software is distributed in the hope that it will be useful, 25 but WITHOUT ANY WARRANTY; without even the implied warranty of 26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 General Public License for more details. 28 29 You should have received a copy of the GNU General Public License 30 along with this software; if not, write to the 31 32 Free Software Foundation, Inc., 33 34 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 35 */ 36 37 38 #ifndef CROSS_LINK_HPP 39 #define CROSS_LINK_HPP 40 //#warning "Entering CROSS_LINK_HPP" 41 42 43 /////////////////////// Local includes 44 #include "crossLinker.hpp" 45 #include "monomer.hpp" 46 47 namespace massXpert 48 { 49 50 class Polymer; 51 52 53 enum CrossLinkEncompassed 54 { 55 MXP_CROSS_LINK_ENCOMPASSED_NO = 0, 56 MXP_CROSS_LINK_ENCOMPASSED_PARTIAL = 1, 57 MXP_CROSS_LINK_ENCOMPASSED_FULL = 2, 58 }; 59 60 class CrossLink : public CrossLinker 61 { 62 protected: 63 // We do not own these two monomers and polymer. 64 QPointer<Polymer> mp_polymer; 65 QList<const Monomer *> m_monomerList; 66 67 QString m_comment; 68 69 public: 70 CrossLink(const PolChemDef *, 71 Polymer *, 72 const QString &, 73 const QString &, 74 const QString & = QString()); 75 76 CrossLink(const CrossLink &); 77 78 CrossLink(const CrossLinker &, 79 Polymer *, 80 const QString & = QString()); 81 82 ~CrossLink(); 83 84 bool setMonomerAt(Monomer *, int); 85 bool appendMonomer(const Monomer *); 86 const Monomer *monomerAt(int); 87 bool removeMonomerAt(int); 88 89 void setPolymer(Polymer *); 90 Polymer *polymer(); 91 92 void setComment(const QString &); 93 const QString &comment()const; 94 95 virtual bool operator ==(const CrossLink &) const; 96 97 int populateMonomerList(QString); 98 QList<const Monomer *> *monomerList(); 99 int monomerIndexList(QList<int> *); 100 QString monomerIndexText(); 101 QString monomerPosText(); 102 103 int involvesMonomer(const Monomer *) const; 104 const Monomer *firstMonomer() const; 105 int encompassedBy(int, int, int *in = 0, int * = 0); 106 int encompassedBy(const CoordinateList &, int *in = 0, int * = 0); 107 108 int involvedMonomers(QList<Monomer *> *); 109 110 111 bool validate(); 112 113 virtual bool calculateMasses(); 114 115 virtual bool accountMasses(double * = 0, double * = 0, int = 1); 116 virtual bool accountMasses(Ponderable *, int = 1); 117 118 QString *prepareResultsTxtString(); 119 }; 120 121 } // namespace massXpert 122 123 124 #endif // CROSS_LINK_HPP 125