Changes in / [27e464:0ac85c3]
- Location:
- src
- Files:
-
- 2 added
- 13 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Atom/AtomicInfo.cpp
r27e464 r0ac85c3 88 88 bool status = true; 89 89 if (_atom.getId() != Id) 90 status &= _atom.changeId(Id);90 status = _atom.changeId(Id); 91 91 92 92 // set its father 93 if (status) { 94 atom * const _father = World::getInstance().getAtom(AtomById(FatherId)); 95 if ((_father == NULL) || (Id == FatherId)) { 96 _atom.father = &_atom; 97 // don't sign on 98 } else { 99 _atom.father = _father; 100 _father->signOn(&_atom); 101 } 93 atom * const _father = World::getInstance().getAtom(AtomById(FatherId)); 94 if (_father == NULL) 95 _atom.father = &_atom; 96 else 97 _atom.father = _father; 102 98 103 // setting molecule 104 molecule * const _mol = World::getInstance().getMolecule(MoleculeById(MolId)); 105 if (_mol != NULL) 106 _atom.setMolecule(_mol); // this is ok, mol is const within AtomicInfo, but not outside (atoms need to register) 107 _atom.changeNr(Nr); 108 } 99 // setting molecule 100 molecule * const _mol = World::getInstance().getMolecule(MoleculeById(MolId)); 101 if (_mol != NULL) 102 _atom.setMolecule(_mol); // this is ok, mol is const within AtomicInfo, but not outside (atoms need to register) 103 _atom.changeNr(Nr); 109 104 110 105 return status; -
src/Atom/atom.cpp
r27e464 r0ac85c3 58 58 mol(0) 59 59 { 60 // note AtomObserver about inserted atom60 // sign on to global atom change tracker 61 61 AtomObserver::getInstance().AtomInserted(this); 62 62 } … … 69 69 mol(0) 70 70 { 71 // sign on to father atom to be notified when it is removed 72 father->signOn(this); 73 74 // note AtomObserver about inserted atom 71 // sign on to global atom change tracker 75 72 AtomObserver::getInstance().AtomInserted(this); 76 73 }; … … 87 84 atom::~atom() 88 85 { 89 // sign off from possible father90 if ((father != this) && (father != NULL))91 father->signOff(this);92 93 86 removeFromMolecule(); 94 // note AtomObserver about removed atom87 // sign off from global atom change tracker 95 88 AtomObserver::getInstance().AtomRemoved(this); 96 89 } … … 132 125 return father->GetTrueFather(); 133 126 } 134 } 135 136 void atom::setFather(atom * const _father) 137 { 138 // sign off from old father 139 if ((father != this) && (father != NULL)) 140 father->signOff(this); 141 142 father = _father; 143 father->signOn(this); 144 } 127 }; 145 128 146 129 /** Sets father to itself or its father in case of copying a molecule. … … 342 325 return atom1->getType()->getAtomicNumber() < atom2->getType()->getAtomicNumber(); 343 326 } 344 /*345 void atom::update(Observable *publisher)346 {}347 348 void atom::recieveNotification(Observable *publisher, Notification_ptr notification)349 {350 ASSERT(0, "atom::recieveNotification() - we are not signed on to any notifications.");351 }352 */353 void atom::subjectKilled(Observable *publisher)354 {355 // as publisher has been half-deallocated (Observable is one of the base classes, hence356 // becomes destroyed latest), we cannot senibly cast it anymore.357 // Hence, we simply have to check here whether it is NOT one of the other instances358 // we are signed on to.359 father = this;360 // no need to sign off361 } -
src/Atom/atom.hpp
r27e464 r0ac85c3 25 25 #include "atom_bondedparticle.hpp" 26 26 #include "atom_graphnode.hpp" 27 #include "atom_observable.hpp"28 27 #include "atom_particleinfo.hpp" 29 28 #include "Atom/TesselPoint.hpp" 30 29 #include "types.hpp" 31 30 32 #include "CodePatterns/Observer/Observer.hpp"33 31 #include "CodePatterns/enumeration.hpp" 34 32 … … 46 44 * Class incorporates position, type 47 45 */ 48 class atom : 49 public GraphNode, 50 public BondedParticle, 51 public TesselPoint 52 { 46 class atom : public GraphNode, public BondedParticle, public TesselPoint { 53 47 friend atom* NewAtom(atomId_t); 54 48 friend void DeleteAtom(atom*); 55 56 atom *father; //!< In many-body bond order fragmentations points to originating atom57 int *sort; //!< sort criteria58 59 49 public: 50 atom *father; //!< In many-body bond order fragmentations points to originating atom 51 int *sort; //!< sort criteria 60 52 61 53 /** Clones this atom. … … 138 130 */ 139 131 const atom *GetTrueFather() const; 140 141 /** Const getter for the atoms father.142 *143 * \return father of this atom144 */145 atom * const getFather() const146 { return father; }147 148 /** Sets the father for this atom.149 *150 * \param _father ptr to father atom151 */152 void setFather(atom * const _father);153 132 154 133 /** Compares the indices of \a this atom with a given \a ptr. … … 249 228 void unsetMolecule(); 250 229 251 // virtual void update(Observable *publisher);252 // virtual void recieveNotification(Observable *publisher, Notification_ptr notification);253 virtual void subjectKilled(Observable *publisher);254 230 255 231 private: -
src/Atom/atom_observable.cpp
r27e464 r0ac85c3 55 55 AtomObservable::~AtomObservable() 56 56 {} 57 58 void AtomObservable::subjectKilled(Observable *publisher)59 {} -
src/Atom/atom_observable.hpp
r27e464 r0ac85c3 41 41 AtomObservable(); 42 42 virtual ~AtomObservable(); 43 44 protected:45 46 virtual void subjectKilled(Observable *publisher);47 43 }; 48 44 -
src/Fragmentation/Exporters/HydrogenPool.cpp
r27e464 r0ac85c3 68 68 ++HydrogenCount; 69 69 70 // give warning if pool has more than th reshold70 // give warning if pool has more than thereshold 71 71 if (HydrogenCount >= WARNINGTHRESHOLD) { 72 72 ELOG(2, "HydrogenPool contains more hydrogen atoms than limit."); -
src/Fragmentation/Exporters/SaturatedFragment.cpp
r27e464 r0ac85c3 311 311 _atom->setFixedIon(true); 312 312 // if we replace hydrogen, we mark it as our father, otherwise we are just an added hydrogen with no father 313 _atom-> setFather(_father);313 _atom->father = _father; 314 314 SaturationHydrogens.insert(_atom->getId()); 315 315 … … 387 387 _atom->setFixedIon(replacement->getFixedIon()); 388 388 // if we replace hydrogen, we mark it as our father, otherwise we are just an added hydrogen with no father 389 _atom-> setFather(replacement);389 _atom->father = replacement; 390 390 SaturationHydrogens.insert(_atom->getId()); 391 391 return _atom; -
src/Graph/BuildInducedSubgraph.cpp
r27e464 r0ac85c3 63 63 LOG(3, "Filling Parent List."); 64 64 for (molecule::iterator iter = Son->begin(); iter != Son->end(); ++iter) { 65 ParentList[(*iter)-> getFather()] = (*iter);65 ParentList[(*iter)->father] = (*iter); 66 66 // Outputting List for debugging 67 LOG(4, "INFO: ParentList[] of " << (*iter)-> getFather() << " is " << *ParentList[(*iter)->getFather()] << ".");67 LOG(4, "INFO: ParentList[] of " << (*iter)->father << " is " << *ParentList[(*iter)->father] << "."); 68 68 } 69 69 } … … 77 77 for (molecule::iterator iter = Father->begin(); iter != Father->end(); ++iter) { 78 78 if (ParentList.count(*iter)) { 79 if (ParentList[(*iter)]-> getFather()!= (*iter)) {79 if (ParentList[(*iter)]->father != (*iter)) { 80 80 status = false; 81 81 } else { -
src/Parser/PdbParser.cpp
r27e464 r0ac85c3 360 360 { 361 361 if (additionalAtomData.find(_atom->getId()) != additionalAtomData.end()) { 362 } else if (additionalAtomData.find(_atom-> getFather()->getId()) != additionalAtomData.end()) {362 } else if (additionalAtomData.find(_atom->father->getId()) != additionalAtomData.end()) { 363 363 // use info from direct father 364 additionalAtomData[_atom->getId()] = additionalAtomData[_atom-> getFather()->getId()];364 additionalAtomData[_atom->getId()] = additionalAtomData[_atom->father->getId()]; 365 365 } else if (additionalAtomData.find(_atom->GetTrueFather()->getId()) != additionalAtomData.end()) { 366 366 // use info from topmost father -
src/UIElements/Makefile.am
r27e464 r0ac85c3 167 167 UIElements/Qt4/QtDialog.cpp \ 168 168 UIElements/Qt4/QtUIFactory.cpp \ 169 UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.cpp \170 UIElements/Views/Qt4/MoleculeList/QtMoleculeItemFactory.cpp \171 UIElements/Views/Qt4/MoleculeList/QtMoleculeList.cpp \172 UIElements/Views/Qt4/MoleculeList/QtMoleculeListView.cpp \173 169 UIElements/Menu/Qt4/QtMenuPipe.cpp \ 174 170 UIElements/Views/Qt4/QtElementList.cpp \ … … 177 173 UIElements/Views/Qt4/QtInfoBox.cpp \ 178 174 UIElements/Views/Qt4/QtLogBox.cpp \ 175 UIElements/Views/Qt4/QtMoleculeList.cpp \ 179 176 UIElements/Views/Qt4/QtShapeController.cpp \ 180 177 UIElements/Views/Qt4/QtShapeList.cpp \ … … 198 195 UIElements/Menu/Qt4/QMenu_tooltip.hpp \ 199 196 UIElements/Menu/Qt4/QtMenuPipe.hpp \ 200 UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp \ 201 UIElements/Views/Qt4/MoleculeList/QtMoleculeListView.hpp \ 197 UIElements/Views/Qt4/QDebugStream.hpp \ 202 198 UIElements/Views/Qt4/QtElementList.hpp \ 203 199 UIElements/Views/Qt4/QtFragmentList.hpp \ … … 205 201 UIElements/Views/Qt4/QtInfoBox.hpp \ 206 202 UIElements/Views/Qt4/QtLogBox.hpp \ 203 UIElements/Views/Qt4/QtMoleculeList.hpp \ 207 204 UIElements/Views/Qt4/QtShapeController.hpp \ 208 205 UIElements/Views/Qt4/QtShapeList.hpp \ … … 227 224 UIElements/Menu/Qt4/QtMenu.hpp \ 228 225 UIElements/Qt4/Query/QtQueryList.hpp \ 229 UIElements/Qt4/QtUIFactory.hpp \ 230 UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp \ 231 UIElements/Views/Qt4/MoleculeList/QtMoleculeItemFactory.hpp \ 232 UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_atomcount.hpp \ 233 UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_formula.hpp \ 234 UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_name.hpp \ 235 UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_occurrence.hpp \ 236 UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_visibility.hpp \ 237 UIElements/Views/Qt4/QDebugStream.hpp 226 UIElements/Qt4/QtUIFactory.hpp 238 227 239 228 lib_LTLIBRARIES += libMolecuilderUI.la -
src/UIElements/Qt4/QtMainWindow.cpp
r27e464 r0ac85c3 53 53 54 54 #include "Menu/Qt4/QtMenu.hpp" 55 #include "Views/Qt4/MoleculeList/QtMoleculeList.hpp" 56 #include "Views/Qt4/MoleculeList/QtMoleculeListView.hpp" 55 #include "Views/Qt4/QtMoleculeList.hpp" 57 56 #include "Views/Qt4/QtElementList.hpp" 58 57 #include "Views/Qt4/QtFragmentList.hpp" … … 96 95 QVBoxLayout *layout = new QVBoxLayout(layoutwidget); 97 96 98 QtMoleculeListView *moleculeListView = new QtMoleculeListView(worldTab); 99 moleculeList = new QtMoleculeList; 100 moleculeListView->setModel(moleculeList); 101 97 moleculeList = new QtMoleculeList(worldTab); 102 98 elementList = new QtElementList(worldTab); 103 99 homologyList = new QtHomologyList(worldTab); … … 133 129 layout->addWidget(worldTab); 134 130 splitter2->addWidget(layoutwidget); 135 worldTab->addTab(moleculeList View, "Molecules");131 worldTab->addTab(moleculeList, "Molecules"); 136 132 worldTab->addTab(elementList, "All Elements"); 137 133 worldTab->addTab(fragmentList, "All Fragments"); -
src/builder.cpp
r27e464 r0ac85c3 39 39 #include "UIElements/UIFactory.hpp" 40 40 41 #ifdef LOG_OBSERVER42 #include "CodePatterns/Observer/ObserverLog.hpp"43 #endif44 45 41 /********************************************** Main routine **************************************/ 46 42 47 43 int main(int argc, char **argv) 48 44 { 49 #ifdef LOG_OBSERVER50 ObserverLog::getInstance().enableLogging();51 #endif52 53 45 initGeneral(); 54 46 -
src/molecule.cpp
r27e464 r0ac85c3 35 35 #include "CodePatterns/MemDebug.hpp" 36 36 37 #include < algorithm>37 #include <cstring> 38 38 #include <boost/bind.hpp> 39 39 #include <boost/foreach.hpp> 40 #include <cstring>41 40 42 41 #include <gsl/gsl_inline.h> … … 103 102 molecule::~molecule() 104 103 { 105 // inform all UI elements about imminent removal before anything is lost106 {107 OBSERVE;108 NOTIFY(AboutToBeRemoved);109 }110 104 CleanupMolecule(); 111 105 }; … … 654 648 void removeAtomsinMolecule(molecule *&_mol) 655 649 { 656 // copy list of atoms from molecule as it will be changed657 std::vector<atom *> atoms;658 atoms.resize(_mol->getAtomCount(), NULL);659 std::copy(_mol->begin(), _mol->end(), atoms.begin());660 650 // remove each atom from world 661 for(std::vector<atom *>::iterator AtomRunner = atoms.begin(); 662 AtomRunner != atoms.end(); ++AtomRunner) 651 for(molecule::iterator AtomRunner = _mol->begin(); !_mol->empty(); AtomRunner = _mol->begin()) 663 652 World::getInstance().destroyAtom(*AtomRunner); 664 653 // make sure that pointer os not usable … … 945 934 output << "Map is "; 946 935 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) { 947 if ((*iter)-> getFather()== NULL) {936 if ((*iter)->father == NULL) { 948 937 AtomicMap[(*iter)->getNr()] = -2; 949 938 } else { … … 951 940 //for (int i=0;i<AtomCount;i++) { // search atom 952 941 //for (int j=0;j<OtherMolecule->getAtomCount();j++) { 953 //LOG(4, "Comparing father " << (*iter)-> getFather() << " with the other one " << (*runner)->getFather()<< ".");954 if ((*iter)-> getFather()== (*runner))942 //LOG(4, "Comparing father " << (*iter)->father << " with the other one " << (*runner)->father << "."); 943 if ((*iter)->father == (*runner)) 955 944 AtomicMap[(*iter)->getNr()] = (*runner)->getNr(); 956 945 } -
src/molecule.hpp
r27e464 r0ac85c3 113 113 AtomMoved, 114 114 MoleculeNameChanged, 115 AboutToBeRemoved,116 115 NotificationType_MAX 117 116 }; -
src/moleculelist.cpp
r27e464 r0ac85c3 409 409 for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) { 410 410 //LOG(1, "(*iter): " << *(*iter) << " with first bond " << *((*iter)->getListOfBonds().begin()) << "."); 411 if (((*iter)->getType()->getAtomicNumber() == 1) && (((*iter)-> getFather()== NULL)412 || ((*iter)-> getFather()->getType()->getAtomicNumber() != 1))) { // if it's a hydrogen411 if (((*iter)->getType()->getAtomicNumber() == 1) && (((*iter)->father == NULL) 412 || ((*iter)->father->getType()->getAtomicNumber() != 1))) { // if it's a hydrogen 413 413 for (molecule::const_iterator runner = (*ListRunner)->begin(); runner != (*ListRunner)->end(); ++runner) { 414 414 //LOG(2, "Runner: " << *(*runner) << " with first bond " << *((*iter)->getListOfBonds().begin()) << ".");
Note:
See TracChangeset
for help on using the changeset viewer.