Changes in / [27e464:0ac85c3]


Ignore:
Location:
src
Files:
2 added
13 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • src/Atom/AtomicInfo.cpp

    r27e464 r0ac85c3  
    8888  bool status = true;
    8989  if (_atom.getId() != Id)
    90     status &= _atom.changeId(Id);
     90    status = _atom.changeId(Id);
    9191
    9292  // 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;
    10298
    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);
    109104
    110105  return status;
  • src/Atom/atom.cpp

    r27e464 r0ac85c3  
    5858  mol(0)
    5959{
    60   // note AtomObserver about inserted atom
     60  // sign on to global atom change tracker
    6161  AtomObserver::getInstance().AtomInserted(this);
    6262}
     
    6969    mol(0)
    7070{
    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
    7572  AtomObserver::getInstance().AtomInserted(this);
    7673};
     
    8784atom::~atom()
    8885{
    89   // sign off from possible father
    90   if ((father != this) && (father != NULL))
    91     father->signOff(this);
    92 
    9386  removeFromMolecule();
    94   // note AtomObserver about removed atom
     87  // sign off from global atom change tracker
    9588  AtomObserver::getInstance().AtomRemoved(this);
    9689}
     
    132125    return father->GetTrueFather();
    133126  }
    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};
    145128
    146129/** Sets father to itself or its father in case of copying a molecule.
     
    342325  return atom1->getType()->getAtomicNumber() < atom2->getType()->getAtomicNumber();
    343326}
    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

    r27e464 r0ac85c3  
    2525#include "atom_bondedparticle.hpp"
    2626#include "atom_graphnode.hpp"
    27 #include "atom_observable.hpp"
    2827#include "atom_particleinfo.hpp"
    2928#include "Atom/TesselPoint.hpp"
    3029#include "types.hpp"
    3130
    32 #include "CodePatterns/Observer/Observer.hpp"
    3331#include "CodePatterns/enumeration.hpp"
    3432
     
    4644 * Class incorporates position, type
    4745 */
    48 class atom :
    49             public GraphNode,
    50             public BondedParticle,
    51             public TesselPoint
    52 {
     46class atom : public GraphNode, public BondedParticle, public TesselPoint {
    5347  friend atom* NewAtom(atomId_t);
    5448  friend void  DeleteAtom(atom*);
    55 
    56   atom *father;   //!< In many-body bond order fragmentations points to originating atom
    57   int *sort;      //!< sort criteria
    58 
    5949public:
     50    atom *father;   //!< In many-body bond order fragmentations points to originating atom
     51    int *sort;      //!< sort criteria
    6052
    6153  /** Clones this atom.
     
    138130   */
    139131  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);
    153132
    154133  /** Compares the indices of \a this atom with a given \a ptr.
     
    249228    void unsetMolecule();
    250229
    251 //    virtual void update(Observable *publisher);
    252 //    virtual void recieveNotification(Observable *publisher, Notification_ptr notification);
    253     virtual void subjectKilled(Observable *publisher);
    254230
    255231  private:
  • src/Atom/atom_observable.cpp

    r27e464 r0ac85c3  
    5555AtomObservable::~AtomObservable()
    5656{}
    57 
    58 void AtomObservable::subjectKilled(Observable *publisher)
    59 {}
  • src/Atom/atom_observable.hpp

    r27e464 r0ac85c3  
    4141  AtomObservable();
    4242  virtual ~AtomObservable();
    43 
    44 protected:
    45 
    46   virtual void subjectKilled(Observable *publisher);
    4743};
    4844
  • src/Fragmentation/Exporters/HydrogenPool.cpp

    r27e464 r0ac85c3  
    6868  ++HydrogenCount;
    6969
    70   // give warning if pool has more than threshold
     70  // give warning if pool has more than thereshold
    7171  if (HydrogenCount >= WARNINGTHRESHOLD) {
    7272    ELOG(2, "HydrogenPool contains more hydrogen atoms than limit.");
  • src/Fragmentation/Exporters/SaturatedFragment.cpp

    r27e464 r0ac85c3  
    311311  _atom->setFixedIon(true);
    312312  // 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;
    314314  SaturationHydrogens.insert(_atom->getId());
    315315
     
    387387  _atom->setFixedIon(replacement->getFixedIon());
    388388  // 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;
    390390  SaturationHydrogens.insert(_atom->getId());
    391391  return _atom;
  • src/Graph/BuildInducedSubgraph.cpp

    r27e464 r0ac85c3  
    6363  LOG(3, "Filling Parent List.");
    6464  for (molecule::iterator iter = Son->begin(); iter != Son->end(); ++iter) {
    65     ParentList[(*iter)->getFather()] = (*iter);
     65    ParentList[(*iter)->father] = (*iter);
    6666    // 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] << ".");
    6868  }
    6969}
     
    7777  for (molecule::iterator iter = Father->begin(); iter != Father->end(); ++iter) {
    7878    if (ParentList.count(*iter)) {
    79       if (ParentList[(*iter)]->getFather() != (*iter)) {
     79      if (ParentList[(*iter)]->father != (*iter)) {
    8080        status = false;
    8181      } else {
  • src/Parser/PdbParser.cpp

    r27e464 r0ac85c3  
    360360{
    361361  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()) {
    363363    // use info from direct father
    364     additionalAtomData[_atom->getId()] = additionalAtomData[_atom->getFather()->getId()];
     364    additionalAtomData[_atom->getId()] = additionalAtomData[_atom->father->getId()];
    365365  } else if (additionalAtomData.find(_atom->GetTrueFather()->getId()) != additionalAtomData.end()) {
    366366    // use info from topmost father
  • src/UIElements/Makefile.am

    r27e464 r0ac85c3  
    167167  UIElements/Qt4/QtDialog.cpp \
    168168  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 \
    173169  UIElements/Menu/Qt4/QtMenuPipe.cpp \
    174170  UIElements/Views/Qt4/QtElementList.cpp \
     
    177173  UIElements/Views/Qt4/QtInfoBox.cpp \
    178174  UIElements/Views/Qt4/QtLogBox.cpp \
     175  UIElements/Views/Qt4/QtMoleculeList.cpp \
    179176  UIElements/Views/Qt4/QtShapeController.cpp \
    180177  UIElements/Views/Qt4/QtShapeList.cpp \
     
    198195  UIElements/Menu/Qt4/QMenu_tooltip.hpp \
    199196  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 \
    202198  UIElements/Views/Qt4/QtElementList.hpp \
    203199  UIElements/Views/Qt4/QtFragmentList.hpp \
     
    205201  UIElements/Views/Qt4/QtInfoBox.hpp \
    206202  UIElements/Views/Qt4/QtLogBox.hpp \
     203  UIElements/Views/Qt4/QtMoleculeList.hpp \
    207204  UIElements/Views/Qt4/QtShapeController.hpp \
    208205  UIElements/Views/Qt4/QtShapeList.hpp \
     
    227224  UIElements/Menu/Qt4/QtMenu.hpp \
    228225  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
    238227
    239228lib_LTLIBRARIES += libMolecuilderUI.la
  • src/UIElements/Qt4/QtMainWindow.cpp

    r27e464 r0ac85c3  
    5353
    5454#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"
    5756#include "Views/Qt4/QtElementList.hpp"
    5857#include "Views/Qt4/QtFragmentList.hpp"
     
    9695  QVBoxLayout *layout = new QVBoxLayout(layoutwidget);
    9796
    98   QtMoleculeListView *moleculeListView = new QtMoleculeListView(worldTab);
    99   moleculeList = new QtMoleculeList;
    100   moleculeListView->setModel(moleculeList);
    101 
     97  moleculeList = new QtMoleculeList(worldTab);
    10298  elementList = new QtElementList(worldTab);
    10399  homologyList = new QtHomologyList(worldTab);
     
    133129  layout->addWidget(worldTab);
    134130  splitter2->addWidget(layoutwidget);
    135   worldTab->addTab(moleculeListView, "Molecules");
     131  worldTab->addTab(moleculeList, "Molecules");
    136132  worldTab->addTab(elementList, "All Elements");
    137133  worldTab->addTab(fragmentList, "All Fragments");
  • src/builder.cpp

    r27e464 r0ac85c3  
    3939#include "UIElements/UIFactory.hpp"
    4040
    41 #ifdef LOG_OBSERVER
    42 #include "CodePatterns/Observer/ObserverLog.hpp"
    43 #endif
    44 
    4541/********************************************** Main routine **************************************/
    4642
    4743int main(int argc, char **argv)
    4844{
    49 #ifdef LOG_OBSERVER
    50   ObserverLog::getInstance().enableLogging();
    51 #endif
    52 
    5345  initGeneral();
    5446
  • src/molecule.cpp

    r27e464 r0ac85c3  
    3535#include "CodePatterns/MemDebug.hpp"
    3636
    37 #include <algorithm>
     37#include <cstring>
    3838#include <boost/bind.hpp>
    3939#include <boost/foreach.hpp>
    40 #include <cstring>
    4140
    4241#include <gsl/gsl_inline.h>
     
    103102molecule::~molecule()
    104103{
    105   // inform all UI elements about imminent removal before anything is lost
    106   {
    107     OBSERVE;
    108     NOTIFY(AboutToBeRemoved);
    109   }
    110104  CleanupMolecule();
    111105};
     
    654648void removeAtomsinMolecule(molecule *&_mol)
    655649{
    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());
    660650  // 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())
    663652    World::getInstance().destroyAtom(*AtomRunner);
    664653  // make sure that pointer os not usable
     
    945934    output << "Map is ";
    946935    for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    947       if ((*iter)->getFather() == NULL) {
     936      if ((*iter)->father == NULL) {
    948937        AtomicMap[(*iter)->getNr()] = -2;
    949938      } else {
     
    951940      //for (int i=0;i<AtomCount;i++) { // search atom
    952941        //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))
    955944            AtomicMap[(*iter)->getNr()] = (*runner)->getNr();
    956945        }
  • src/molecule.hpp

    r27e464 r0ac85c3  
    113113    AtomMoved,
    114114    MoleculeNameChanged,
    115     AboutToBeRemoved,
    116115    NotificationType_MAX
    117116  };
  • src/moleculelist.cpp

    r27e464 r0ac85c3  
    409409    for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {
    410410      //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 hydrogen
     411      if (((*iter)->getType()->getAtomicNumber() == 1) && (((*iter)->father == NULL)
     412          || ((*iter)->father->getType()->getAtomicNumber() != 1))) { // if it's a hydrogen
    413413        for (molecule::const_iterator runner = (*ListRunner)->begin(); runner != (*ListRunner)->end(); ++runner) {
    414414          //LOG(2, "Runner: " << *(*runner) << " with first bond " << *((*iter)->getListOfBonds().begin()) << ".");
Note: See TracChangeset for help on using the changeset viewer.