Changes in / [0ac85c3:27e464]
- Location:
- src
- Files:
-
- 13 added
- 2 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Atom/AtomicInfo.cpp
r0ac85c3 r27e464 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 atom * const _father = World::getInstance().getAtom(AtomById(FatherId)); 94 if (_father == NULL) 95 _atom.father = &_atom; 96 else 97 _atom.father = _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 } 98 102 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); 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 } 104 109 105 110 return status; -
src/Atom/atom.cpp
r0ac85c3 r27e464 58 58 mol(0) 59 59 { 60 // sign on to global atom change tracker60 // note AtomObserver about inserted atom 61 61 AtomObserver::getInstance().AtomInserted(this); 62 62 } … … 69 69 mol(0) 70 70 { 71 // sign on to global atom change tracker 71 // sign on to father atom to be notified when it is removed 72 father->signOn(this); 73 74 // note AtomObserver about inserted atom 72 75 AtomObserver::getInstance().AtomInserted(this); 73 76 }; … … 84 87 atom::~atom() 85 88 { 89 // sign off from possible father 90 if ((father != this) && (father != NULL)) 91 father->signOff(this); 92 86 93 removeFromMolecule(); 87 // sign off from global atom change tracker94 // note AtomObserver about removed atom 88 95 AtomObserver::getInstance().AtomRemoved(this); 89 96 } … … 125 132 return father->GetTrueFather(); 126 133 } 127 }; 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 } 128 145 129 146 /** Sets father to itself or its father in case of copying a molecule. … … 325 342 return atom1->getType()->getAtomicNumber() < atom2->getType()->getAtomicNumber(); 326 343 } 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, hence 356 // 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 instances 358 // we are signed on to. 359 father = this; 360 // no need to sign off 361 } -
src/Atom/atom.hpp
r0ac85c3 r27e464 25 25 #include "atom_bondedparticle.hpp" 26 26 #include "atom_graphnode.hpp" 27 #include "atom_observable.hpp" 27 28 #include "atom_particleinfo.hpp" 28 29 #include "Atom/TesselPoint.hpp" 29 30 #include "types.hpp" 30 31 32 #include "CodePatterns/Observer/Observer.hpp" 31 33 #include "CodePatterns/enumeration.hpp" 32 34 … … 44 46 * Class incorporates position, type 45 47 */ 46 class atom : public GraphNode, public BondedParticle, public TesselPoint { 48 class atom : 49 public GraphNode, 50 public BondedParticle, 51 public TesselPoint 52 { 47 53 friend atom* NewAtom(atomId_t); 48 54 friend void DeleteAtom(atom*); 55 56 atom *father; //!< In many-body bond order fragmentations points to originating atom 57 int *sort; //!< sort criteria 58 49 59 public: 50 atom *father; //!< In many-body bond order fragmentations points to originating atom51 int *sort; //!< sort criteria52 60 53 61 /** Clones this atom. … … 130 138 */ 131 139 const atom *GetTrueFather() const; 140 141 /** Const getter for the atoms father. 142 * 143 * \return father of this atom 144 */ 145 atom * const getFather() const 146 { return father; } 147 148 /** Sets the father for this atom. 149 * 150 * \param _father ptr to father atom 151 */ 152 void setFather(atom * const _father); 132 153 133 154 /** Compares the indices of \a this atom with a given \a ptr. … … 228 249 void unsetMolecule(); 229 250 251 // virtual void update(Observable *publisher); 252 // virtual void recieveNotification(Observable *publisher, Notification_ptr notification); 253 virtual void subjectKilled(Observable *publisher); 230 254 231 255 private: -
src/Atom/atom_observable.cpp
r0ac85c3 r27e464 55 55 AtomObservable::~AtomObservable() 56 56 {} 57 58 void AtomObservable::subjectKilled(Observable *publisher) 59 {} -
src/Atom/atom_observable.hpp
r0ac85c3 r27e464 41 41 AtomObservable(); 42 42 virtual ~AtomObservable(); 43 44 protected: 45 46 virtual void subjectKilled(Observable *publisher); 43 47 }; 44 48 -
src/Fragmentation/Exporters/HydrogenPool.cpp
r0ac85c3 r27e464 68 68 ++HydrogenCount; 69 69 70 // give warning if pool has more than th ereshold70 // give warning if pool has more than threshold 71 71 if (HydrogenCount >= WARNINGTHRESHOLD) { 72 72 ELOG(2, "HydrogenPool contains more hydrogen atoms than limit."); -
src/Fragmentation/Exporters/SaturatedFragment.cpp
r0ac85c3 r27e464 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-> father = _father;313 _atom->setFather(_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-> father = replacement;389 _atom->setFather(replacement); 390 390 SaturationHydrogens.insert(_atom->getId()); 391 391 return _atom; -
src/Graph/BuildInducedSubgraph.cpp
r0ac85c3 r27e464 63 63 LOG(3, "Filling Parent List."); 64 64 for (molecule::iterator iter = Son->begin(); iter != Son->end(); ++iter) { 65 ParentList[(*iter)-> father] = (*iter);65 ParentList[(*iter)->getFather()] = (*iter); 66 66 // Outputting List for debugging 67 LOG(4, "INFO: ParentList[] of " << (*iter)-> father << " is " << *ParentList[(*iter)->father] << ".");67 LOG(4, "INFO: ParentList[] of " << (*iter)->getFather() << " is " << *ParentList[(*iter)->getFather()] << "."); 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)]-> father!= (*iter)) {79 if (ParentList[(*iter)]->getFather() != (*iter)) { 80 80 status = false; 81 81 } else { -
src/Parser/PdbParser.cpp
r0ac85c3 r27e464 360 360 { 361 361 if (additionalAtomData.find(_atom->getId()) != additionalAtomData.end()) { 362 } else if (additionalAtomData.find(_atom-> father->getId()) != additionalAtomData.end()) {362 } else if (additionalAtomData.find(_atom->getFather()->getId()) != additionalAtomData.end()) { 363 363 // use info from direct father 364 additionalAtomData[_atom->getId()] = additionalAtomData[_atom-> father->getId()];364 additionalAtomData[_atom->getId()] = additionalAtomData[_atom->getFather()->getId()]; 365 365 } else if (additionalAtomData.find(_atom->GetTrueFather()->getId()) != additionalAtomData.end()) { 366 366 // use info from topmost father -
src/UIElements/Makefile.am
r0ac85c3 r27e464 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 \ 169 173 UIElements/Menu/Qt4/QtMenuPipe.cpp \ 170 174 UIElements/Views/Qt4/QtElementList.cpp \ … … 173 177 UIElements/Views/Qt4/QtInfoBox.cpp \ 174 178 UIElements/Views/Qt4/QtLogBox.cpp \ 175 UIElements/Views/Qt4/QtMoleculeList.cpp \176 179 UIElements/Views/Qt4/QtShapeController.cpp \ 177 180 UIElements/Views/Qt4/QtShapeList.cpp \ … … 195 198 UIElements/Menu/Qt4/QMenu_tooltip.hpp \ 196 199 UIElements/Menu/Qt4/QtMenuPipe.hpp \ 197 UIElements/Views/Qt4/QDebugStream.hpp \ 200 UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp \ 201 UIElements/Views/Qt4/MoleculeList/QtMoleculeListView.hpp \ 198 202 UIElements/Views/Qt4/QtElementList.hpp \ 199 203 UIElements/Views/Qt4/QtFragmentList.hpp \ … … 201 205 UIElements/Views/Qt4/QtInfoBox.hpp \ 202 206 UIElements/Views/Qt4/QtLogBox.hpp \ 203 UIElements/Views/Qt4/QtMoleculeList.hpp \204 207 UIElements/Views/Qt4/QtShapeController.hpp \ 205 208 UIElements/Views/Qt4/QtShapeList.hpp \ … … 224 227 UIElements/Menu/Qt4/QtMenu.hpp \ 225 228 UIElements/Qt4/Query/QtQueryList.hpp \ 226 UIElements/Qt4/QtUIFactory.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 227 238 228 239 lib_LTLIBRARIES += libMolecuilderUI.la -
src/UIElements/Qt4/QtMainWindow.cpp
r0ac85c3 r27e464 53 53 54 54 #include "Menu/Qt4/QtMenu.hpp" 55 #include "Views/Qt4/QtMoleculeList.hpp" 55 #include "Views/Qt4/MoleculeList/QtMoleculeList.hpp" 56 #include "Views/Qt4/MoleculeList/QtMoleculeListView.hpp" 56 57 #include "Views/Qt4/QtElementList.hpp" 57 58 #include "Views/Qt4/QtFragmentList.hpp" … … 95 96 QVBoxLayout *layout = new QVBoxLayout(layoutwidget); 96 97 97 moleculeList = new QtMoleculeList(worldTab); 98 QtMoleculeListView *moleculeListView = new QtMoleculeListView(worldTab); 99 moleculeList = new QtMoleculeList; 100 moleculeListView->setModel(moleculeList); 101 98 102 elementList = new QtElementList(worldTab); 99 103 homologyList = new QtHomologyList(worldTab); … … 129 133 layout->addWidget(worldTab); 130 134 splitter2->addWidget(layoutwidget); 131 worldTab->addTab(moleculeList , "Molecules");135 worldTab->addTab(moleculeListView, "Molecules"); 132 136 worldTab->addTab(elementList, "All Elements"); 133 137 worldTab->addTab(fragmentList, "All Fragments"); -
src/builder.cpp
r0ac85c3 r27e464 39 39 #include "UIElements/UIFactory.hpp" 40 40 41 #ifdef LOG_OBSERVER 42 #include "CodePatterns/Observer/ObserverLog.hpp" 43 #endif 44 41 45 /********************************************** Main routine **************************************/ 42 46 43 47 int main(int argc, char **argv) 44 48 { 49 #ifdef LOG_OBSERVER 50 ObserverLog::getInstance().enableLogging(); 51 #endif 52 45 53 initGeneral(); 46 54 -
src/molecule.cpp
r0ac85c3 r27e464 35 35 #include "CodePatterns/MemDebug.hpp" 36 36 37 #include < cstring>37 #include <algorithm> 38 38 #include <boost/bind.hpp> 39 39 #include <boost/foreach.hpp> 40 #include <cstring> 40 41 41 42 #include <gsl/gsl_inline.h> … … 102 103 molecule::~molecule() 103 104 { 105 // inform all UI elements about imminent removal before anything is lost 106 { 107 OBSERVE; 108 NOTIFY(AboutToBeRemoved); 109 } 104 110 CleanupMolecule(); 105 111 }; … … 648 654 void removeAtomsinMolecule(molecule *&_mol) 649 655 { 656 // copy list of atoms from molecule as it will be changed 657 std::vector<atom *> atoms; 658 atoms.resize(_mol->getAtomCount(), NULL); 659 std::copy(_mol->begin(), _mol->end(), atoms.begin()); 650 660 // remove each atom from world 651 for(molecule::iterator AtomRunner = _mol->begin(); !_mol->empty(); AtomRunner = _mol->begin()) 661 for(std::vector<atom *>::iterator AtomRunner = atoms.begin(); 662 AtomRunner != atoms.end(); ++AtomRunner) 652 663 World::getInstance().destroyAtom(*AtomRunner); 653 664 // make sure that pointer os not usable … … 934 945 output << "Map is "; 935 946 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) { 936 if ((*iter)-> father== NULL) {947 if ((*iter)->getFather() == NULL) { 937 948 AtomicMap[(*iter)->getNr()] = -2; 938 949 } else { … … 940 951 //for (int i=0;i<AtomCount;i++) { // search atom 941 952 //for (int j=0;j<OtherMolecule->getAtomCount();j++) { 942 //LOG(4, "Comparing father " << (*iter)-> father << " with the other one " << (*runner)->father<< ".");943 if ((*iter)-> father== (*runner))953 //LOG(4, "Comparing father " << (*iter)->getFather() << " with the other one " << (*runner)->getFather() << "."); 954 if ((*iter)->getFather() == (*runner)) 944 955 AtomicMap[(*iter)->getNr()] = (*runner)->getNr(); 945 956 } -
src/molecule.hpp
r0ac85c3 r27e464 113 113 AtomMoved, 114 114 MoleculeNameChanged, 115 AboutToBeRemoved, 115 116 NotificationType_MAX 116 117 }; -
src/moleculelist.cpp
r0ac85c3 r27e464 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)-> father== NULL)412 || ((*iter)-> father->getType()->getAtomicNumber() != 1))) { // if it's a hydrogen411 if (((*iter)->getType()->getAtomicNumber() == 1) && (((*iter)->getFather() == NULL) 412 || ((*iter)->getFather()->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.