Changes in / [b1d8092:7ba324]


Ignore:
Files:
2 added
17 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    rb1d8092 r7ba324  
    2727
    2828# Boost libraries
    29 AX_BOOST_BASE([1.33.1])
     29#AX_BOOST_BASE([1.33.1])
    3030#AX_BOOST_PROGRAM_OPTIONS
    3131#AX_BOOST_FOREACH
    3232#AX_BOOST_FILESYSTEM
    33 AX_BOOST_THREAD
     33#AX_BOOST_THREAD
    3434#AX_BOOST_PROGRAM_OPTIONS
    3535#AX_BOOST_SERIALIZATION
  • src/Makefile.am

    rb1d8092 r7ba324  
    1212
    1313PATTERNSOURCE = Patterns/Observer.cpp
    14 PATTERNHEADER = Patterns/Observer.hpp Patterns/Cacheable.hpp
     14PATTERNHEADER = Patterns/Observer.hpp
    1515
    1616VIEWSOURCE = Views/View.cpp Views/StringView.cpp Views/MethodStringView.cpp Views/StreamStringView.cpp
     
    2323UIHEADER = ${ACTIONSHEADER} ${VIEWHEADER} ${MENUHEADER} UIElements/TextUIFactory.hpp UIElements/MainWindow.hpp UIElements/TextWindow.hpp UIElements/Dialog.hpp UIElements/TextDialog.hpp
    2424
    25 
    2625FACTORYSOURCE = UIElements/UIFactory.cpp
    2726FACTORYHEADER = UIElements/UIFactory.hpp
    2827
    29 # all these files are only used for legacy reasons while the transition is in progress
    30 # they are only needed to keep the program usable at any point of the transition and will be
    31 # deleted once everything is fully refactored
    32 LEGACYSOURCE = Legacy/oldmenu.cpp
    33 LEGACYHEADER = Legacy/oldmenu.hpp
    34 
    35 
    3628QTUIMOC_HEADER = UIElements/QT4/QTMainWindow.hpp UIElements/QT4/QTDialog.hpp Menu/QT4/QTMenu.hpp  Views/QT4/QTMoleculesView.hpp Views/QT4/GLMoleculeView.hpp
    3729QTUIMOC_TARGETS = QTMainWindow.moc.cpp QTMenu.moc.cpp QTDialog.moc.cpp QTMoleculesView.moc.cpp GLMoleculeView.moc.cpp
    38 
    39 DESCRIPTORSOURCE = Descriptors/AtomDescriptor.cpp Descriptors/AtomIdDescriptor.cpp
    40 DESCRIPTORHEADER = Descriptors/AtomDescriptor.hpp Descriptors/AtomIdDescriptor.hpp
    4130
    4231QTUISOURCE = ${QTUIMOC_TARGETS} UIElements/QT4/QTMainWindow.cpp UIElements/QT4/QTDialog.cpp UIElements/QT4/QTUIFactory.cpp Menu/QT4/QTMenu.cpp Views/QT4/QTMoleculesView.cpp Views/QT4/GLMoleculeView.cpp
     
    4534QTUI_DEFS =
    4635
    47 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${PATTERNSOURCE} ${DESCRIPTORSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp World.cpp
    48 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} ${PATTERNHEADER} ${DESCRIPTORHEADER} ${LEGACYHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp World.hpp
    49 
     36SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${PATTERNSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp menu.cpp
     37HEADER = ${ANALYSISHEADER} ${ATOMHEADER} ${PATTERNHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp menu.hpp
    5038
    5139BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB)
    52 GUI_LIBS = ${QT_LDADD} ${QT_LIB_GUI} -lQtOpenGL ${GLU_LIBS}
    5340INCLUDES = -I$(top_srcdir)/src/unittests
    5441
     
    5643bin_PROGRAMS = molecuilder molecuildergui joiner analyzer
    5744molecuilderdir = ${bindir}
    58 
    59 #libmolecuilder_a_CXXFLAGS = -DNO_CACHING
    6045libmolecuilder_a_SOURCES = ${SOURCE} ${HEADER}
    61 
    6246libmenu_a_SOURCES = ${UISOURCE} ${UIHEADER}
    63 
    6447libgslwrapper_a_SOURCES = ${LINALGSOURCE} ${LINALGHEADER}
    65 
    6648molecuilder_DATA = elements.db valence.db orbitals.db Hbonddistance.db Hbondangle.db
    67 
    68 molecuilder_CXXFLAGS = $(BOOST_CPPFLAGS)
    69 #molecuilder_CXXFLAGS += -DNO_CACHING
    7049molecuilder_LDFLAGS = $(BOOST_LIB)
    71 molecuilder_SOURCES = ${FACTORYSOURCE} ${LEGACYSOURCE} builder.cpp
     50molecuilder_SOURCES = ${FACTORYSOURCE} menu.cpp builder.cpp
    7251molecuilder_SOURCES += $(srcdir)/version.c
    73 molecuilder_LDADD = libmolecuilder.a libgslwrapper.a libmenu.a ${BOOST_THREAD_LIB}
    74 
     52molecuilder_LDADD = libmolecuilder.a libgslwrapper.a libmenu.a
    7553#Stuff for building the GUI using QT
    76 molecuildergui_SOURCES = ${QTUISOURCE} ${FACTORYSOURCE} ${LEGACYSOURCE} builder.cpp
     54molecuildergui_SOURCES = ${QTUISOURCE} ${FACTORYSOURCE} menu.cpp builder.cpp
    7755molecuildergui_SOURCES += $(srcdir)/version.c
    7856molecuildergui_CXXFLAGS = ${QT_CXXFLAGS} ${GLU_CXXFLAGS} -DUSE_GUI_QT
    7957molecuildergui_LDFLAGS = $(BOOST_LIB) ${QT_LDFLAGS} ${GLU_LDFLAGS}
    80 molecuildergui_LDADD = libmolecuilder.a libgslwrapper.a libmenu.a ${BOOST_THREAD_LIB} ${GUI_LIBS}
    81 
     58molecuildergui_LDADD = libmolecuilder.a libgslwrapper.a libmenu.a ${QT_LDADD} ${QT_LIB_GUI} -lQtOpenGL ${GLU_LIBS}
    8259joiner_SOURCES = joiner.cpp datacreator.cpp parser.cpp datacreator.hpp helpers.hpp parser.hpp periodentafel.hpp
    83 joiner_LDADD = libmolecuilder.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
    84 
     60joiner_LDADD = libmolecuilder.a
    8561analyzer_SOURCES = analyzer.cpp datacreator.cpp parser.cpp helpers.hpp periodentafel.hpp parser.hpp datacreator.hpp
    86 analyzer_LDADD = libmolecuilder.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
     62analyzer_LDADD = libmolecuilder.a
    8763
    8864#Rules needed for QT4
  • src/Patterns/Observer.cpp

    rb1d8092 r7ba324  
    1010
    1111#include <iostream>
    12 #include <cassert>
    1312
    1413using namespace std;
     
    2524
    2625map<Observable*, int> Observable::depth;
    27 map<Observable*,multimap<int,Observer*>*> Observable::callTable;
     26multimap<Observable*,Observer*> Observable::callTable;
    2827set<Observable*> Observable::busyObservables;
    2928
     
    5352}
    5453
    55 Observable::_Observable_protector::_Observable_protector(Observable *_protege) :
    56   protege(_protege)
    57 {
    58   start_observer_internal(protege);
    59 }
    60 
    61 Observable::_Observable_protector::~_Observable_protector()
    62 {
    63   finish_observer_internal(protege);
    64 }
    65 
    6654/************* Notification mechanism for observables **************/
    6755
     56typedef multimap<Observable*,Observer*>::iterator callIterator;
     57typedef pair<callIterator, callIterator> iteratorRange;
    6858
    6959void Observable::notifyAll() {
     
    7464  // and call all observers
    7565  if(callTable.count(this)) {
    76     // elements are stored sorted by keys in the multimap
    77     // so iterating over it gives us a the callees sorted by
    78     // the priorities
    79     callees_t *callees = callTable[this];
    80     callees_t::iterator iter;
    81     for(iter=callees->begin();iter!=callees->end();iter++){
    82       (*iter).second->update(this);
    83     }
     66     iteratorRange callerRange = callTable.equal_range(this);
     67     callIterator iter;
     68     for(iter=callerRange.first;iter!=callerRange.second;iter++){
     69       (*iter).second->update(this);
     70     }
    8471  }
    8572  // done with notification, we can leave the set of busy subjects
     
    11097
    11198// methods to sign-on and off
    112 void Observable::signOn(Observer *target,int priority) {
    113   assert(priority>=-20 && priority<=+20 && "Priority out of range [-20:+20]");
     99void Observable::signOn(Observer *target) {
    114100  bool res = false;
    115   callees_t *callees = 0;
    116   if(callTable.count(this)){
    117     callees = callTable[this];
    118   }
    119   else {
    120     callees = new multimap<int,Observer*>;
    121     callTable.insert(pair<Observable*,callees_t*>(this,callees));
    122   }
    123 
    124   callees_t::iterator iter;
    125   for(iter=callees->begin();iter!=callees->end();iter++){
     101  iteratorRange callerRange = callTable.equal_range(this);
     102  callIterator iter;
     103  for(iter=callerRange.first;iter!=callerRange.second;iter++){
    126104    res |= ((*iter).second == target);
    127105  }
    128106  if(!res)
    129     callees->insert(pair<int,Observer*>(priority,target));
     107    callTable.insert(pair<Observable*,Observer*>(this,target));
    130108}
    131109
    132110void Observable::signOff(Observer *target) {
    133   assert(callTable.count(this) && "SignOff called for an Observable without Observers.");
    134   callees_t *callees = callTable[this];
    135   callees_t::iterator iter;
    136   for(iter=callees->begin();iter!=callees->end();iter++) {
     111  iteratorRange callerRange = callTable.equal_range(this);
     112  callIterator iter;
     113  for(iter=callerRange.first;iter!=callerRange.second;iter++) {
    137114    if((*iter).second == target)
    138       callees->erase(iter);
    139   }
    140   if(callees->empty()){
    141     callTable.erase(this);
    142     delete callees;
     115      callTable.erase(iter);
    143116  }
    144117}
     
    154127Observable::~Observable()
    155128{
    156   if(callTable.count(this)) {
    157     // delete all entries for this observable
    158     callees_t *callees = callTable[this];
    159     callees_t::iterator iter;
    160     for(iter=callees->begin();iter!=callees->end();iter++){
    161       (*iter).second->subjectKilled(this);
    162     }
    163     callTable.erase(this);
    164     delete callees;
     129  // delete all entries for this observable
     130  iteratorRange callerRange = callTable.equal_range(this);
     131  callIterator iter;
     132  for(iter=callerRange.first;iter!=callerRange.second;iter++){
     133    (*iter).second->subjectKilled(this);
    165134  }
     135  callTable.erase(callerRange.first,callerRange.second);
    166136}
    167137
  • src/Patterns/Observer.hpp

    rb1d8092 r7ba324  
    1616 *
    1717 * Observers register themselves with the observables to be notified when something changes.
    18  * In the Observable code that changes attributes should be started with OBSERVE;. This macro
    19  * locks the observer mechanism while changes are done. At the end of the scope in which the
    20  * macro was placed the lock is released. When the last lock is released all changes are
    21  * propagated to the observers.
     18 * In the Observable code that changes attributes should be wrapped in
     19 * START_OBSERVER ... END_OBSERVER blocks. If other methods are called that also contain
     20 * Observation blocks from there, these functions wont trigger notifications. Only the end
     21 * of the final observation block triggers the update of Observers.
    2222 *
    2323 * Each observerable can have sub-observables. When one of these sub-observables changes and
     
    4747  virtual ~Observable();
    4848
    49   virtual void signOn(Observer *target, int priority=0);
     49  virtual void signOn(Observer *target);
    5050  virtual void signOff(Observer *target);
    5151
     
    5959  /**
    6060   * Internal method.
    61    * Do not call directly. Use OBSERVE macro instead
     61   * Do not call directly. Use START_OBSERVER macro instead
    6262   */
    6363  static void start_observer_internal(Observable *publisher);
    6464  /**
    6565   * Internal method.
    66    * Do not call directly. Use OBSERVE macro instead
     66   * Do not call directly. Use FINISH_OBSERVER macro instead
    6767   */
    6868  static void finish_observer_internal(Observable *publisher);
    6969
    7070private:
    71   typedef std::multimap<int,Observer*> callees_t;
    7271  static std::map<Observable*, int> depth;
    73   static std::map<Observable*,callees_t*> callTable;
     72  static std::multimap<Observable*,Observer*> callTable;
    7473  static std::set<Observable*> busyObservables;
    75 
    76   // Structure for RAII-Style notification
    77 protected:
    78   class _Observable_protector {
    79   public:
    80     _Observable_protector(Observable *);
    81     ~_Observable_protector();
    82   private:
    83     Observable *protege;
    84   };
    8574};
    8675
    87 // extra macro is necessary to work with __LINE__
    88 #define PASTE(a,b) PASTE_HELPER(a,b)
    89 #define PASTE_HELPER(a,b) a ## b
    90 #define OBSERVE Observable::_Observable_protector PASTE(_scope_obs_protector_,__LINE__)(this)
    91 // deprecated macros from before RAII was used
    92 //#define START_OBSERVER Observable::start_observer_internal(this);do{do{}while(0)
    93 //#define FINISH_OBSERVER }while(0);Observable::finish_observer_internal(this)
    94 //#define RETURN_OBSERVER( retval ) do{Observable::finish_observer_internal(this); return (retval);}while(0)
     76
     77
     78#define START_OBSERVER Observable::start_observer_internal(this);do{do{}while(0)
     79#define FINISH_OBSERVER }while(0);Observable::finish_observer_internal(this)
    9580#endif /* OBSERVER_HPP_ */
  • src/UIElements/TextWindow.cpp

    rb1d8092 r7ba324  
    2828#include "periodentafel.hpp"
    2929
    30 #include "Legacy/oldmenu.hpp"
     30#include "../menu.hpp"
    3131
    3232#include "Menu/Menu.hpp"
  • src/atom.cpp

    rb1d8092 r7ba324  
    1313#include "parser.hpp"
    1414#include "vector.hpp"
    15 #include "World.hpp"
    1615
    1716/************************************* Functions for class atom *************************************/
     
    2221atom::atom() : previous(NULL), next(NULL), father(this), sort(&nr)
    2322{
    24   World::get()->registerAtom(this);
    2523  node = &x;  // TesselPoint::x can only be referenced from here
    2624};
     
    3028atom::atom(atom *pointer) : previous(NULL), next(NULL), father(pointer), sort(&nr)
    3129{
    32   World::get()->registerAtom(this);
    3330  type = pointer->type;  // copy element of atom
    3431  x.CopyVector(&pointer->x); // copy coordination
     
    4340atom::~atom()
    4441{
    45   World::get()->unregisterAtom(this);
    4642  unlink(this);
    4743};
  • src/atom_particleinfo.cpp

    rb1d8092 r7ba324  
    2020};
    2121
    22 int ParticleInfo::getId() {
    23   return nr;
    24 }
    25 
    2622ostream & operator << (ostream &ost, const ParticleInfo &a)
    2723{
  • src/atom_particleinfo.hpp

    rb1d8092 r7ba324  
    3535  ostream & operator << (ostream &ost) const;
    3636
    37   virtual int getId();
    38 
    3937private:
    4038};
  • src/builder.cpp

    rb1d8092 r7ba324  
    7676#include "Actions/MethodAction.hpp"
    7777#include "Actions/small_actions.hpp"
    78 #include "World.hpp"
    7978#include "version.h"
    8079
     
    21672166/********************************************** Main routine **************************************/
    21682167
    2169 void cleanUp(config *configuration){
    2170   World::destroy();
    2171   delete(configuration);
    2172   Log() << Verbose(0) <<  "Maximum of allocated memory: "
    2173     << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl;
    2174   Log() << Verbose(0) <<  "Remaining non-freed memory: "
    2175     << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl;
    2176   MemoryUsageObserver::purgeInstance();
    2177   logger::purgeInstance();
    2178   errorLogger::purgeInstance();
    2179   UIFactory::purgeInstance();
    2180   ActionRegistry::purgeRegistry();
    2181 }
    2182 
    21832168int main(int argc, char **argv)
    21842169{
     2170  periodentafel *periode = new periodentafel;
     2171    MoleculeListClass *molecules = new MoleculeListClass;
    21852172    molecule *mol = NULL;
    21862173    config *configuration = new config;
     
    21932180    setVerbosity(0);
    21942181    /* structure of ParseCommandLineOptions will be refactored later */
    2195     j = ParseCommandLineOptions(argc, argv,  World::get()->getMolecules(), World::get()->getPeriode(), *configuration, ConfigFileName);
     2182    j = ParseCommandLineOptions(argc, argv, molecules, periode, *configuration, ConfigFileName);
    21962183    switch (j){
    21972184        case 255:
    21982185        case 2:
    21992186        case 1:
    2200             cleanUp(configuration);
     2187            delete (molecules);
     2188            delete (periode);
     2189            delete (configuration);
     2190            Log() << Verbose(0) << "Maximum of allocated memory: " << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl;
     2191            Log() << Verbose(0) << "Remaining non-freed memory: " << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl;
     2192            MemoryUsageObserver::getInstance()->purgeInstance();
     2193            logger::purgeInstance();
     2194            errorLogger::purgeInstance();
    22012195            return (j == 1 ? 0 : j);
    22022196        default:
    22032197            break;
    22042198    }
    2205     if(World::get()->numMolecules() == 0){
    2206         mol = World::get()->createMolecule();
     2199    if(molecules->ListOfMolecules.size() == 0){
     2200        mol = new molecule(periode);
    22072201        if(mol->cell_size[0] == 0.){
    22082202            Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl;
     
    22122206            }
    22132207        }
     2208
    22142209        mol->ActiveFlag = true;
     2210        molecules->insert(mol);
    22152211    }
    22162212
     
    22282224      UIFactory::makeUserInterface(UIFactory::Text);
    22292225#endif
    2230       MainWindow *mainWindow = UIFactory::get()->makeMainWindow(populaters,World::get()->getMolecules(), configuration, World::get()->getPeriode(), ConfigFileName);
     2226      MainWindow *mainWindow = UIFactory::get()->makeMainWindow(populaters,molecules, configuration, periode, ConfigFileName);
    22312227      mainWindow->display();
    22322228
     
    22342230    }
    22352231
    2236     if(World::get()->getPeriode()->StorePeriodentafel(configuration->databasepath))
     2232    if(periode->StorePeriodentafel(configuration->databasepath))
    22372233        Log() << Verbose(0) << "Saving of elements.db successful." << endl;
    22382234
     
    22402236        Log() << Verbose(0) << "Saving of elements.db failed." << endl;
    22412237
    2242   cleanUp(configuration);
     2238    delete (molecules);
     2239    delete(periode);
     2240  delete(configuration);
     2241
     2242
     2243
     2244  Log() << Verbose(0) <<  "Maximum of allocated memory: "
     2245    << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl;
     2246  Log() << Verbose(0) <<  "Remaining non-freed memory: "
     2247    << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl;
     2248  MemoryUsageObserver::purgeInstance();
     2249  logger::purgeInstance();
     2250  errorLogger::purgeInstance();
     2251  UIFactory::purgeInstance();
     2252  ActionRegistry::purgeRegistry();
    22432253  return (0);
    22442254}
  • src/molecule.cpp

    rb1d8092 r7ba324  
    66
    77#include <cstring>
    8 #include <boost/bind.hpp>
    98
    109#include "atom.hpp"
     
    3332  first(new bond(start, end, 1, -1)), last(new bond(start, end, 1, -1)), MDSteps(0), AtomCount(0),
    3433  BondCount(0), ElementCount(0), NoNonHydrogen(0), NoNonBonds(0), NoCyclicBonds(0), BondDistance(0.),
    35   ActiveFlag(false), IndexNr(-1), last_atom(0), InternalPointer(start),
    36   formula(this,boost::bind(&molecule::calcFormula,this))
     34  ActiveFlag(false), IndexNr(-1), last_atom(0), InternalPointer(start)
    3735{
    3836  // init atom chain list
     
    7169
    7270void molecule::setName(const std::string _name){
    73   OBSERVE;
     71  START_OBSERVER;
    7472  strncpy(name,_name.c_str(),MAXSTRINGSIZE);
    75 }
    76 
    77 const std::string molecule::getFormula(){
    78   return *formula;
    79 }
    80 
    81 std::string molecule::calcFormula(){
    82   int Counts[MAX_ELEMENTS];
    83   stringstream sstr;
    84   for (int j = 0; j<MAX_ELEMENTS;j++)
    85     Counts[j] = 0;
    86   for(atom *Walker = start; Walker != end; Walker = Walker->next) {
    87     Counts[Walker->type->Z]++;
    88   }
    89   for(element* Elemental = elemente->end; Elemental != elemente->start; Elemental = Elemental->previous) {
    90     if (Counts[Elemental->Z] != 0)
    91       sstr << Elemental->symbol << Counts[Elemental->Z];
    92   }
    93   return sstr.str();
     73  FINISH_OBSERVER;
    9474}
    9575
     
    10282bool molecule::AddAtom(atom *pointer)
    10383{
    104   bool retval = false;
    105   OBSERVE;
    10684  if (pointer != NULL) {
    10785    pointer->sort = &pointer->nr;
     
    12098      }
    12199    }
    122     retval = add(pointer, end);
    123   }
    124   return retval;
     100    return add(pointer, end);
     101  } else
     102    return false;
    125103};
    126104
     
    132110atom * molecule::AddCopyAtom(atom *pointer)
    133111{
    134   atom *retval = NULL;
    135   OBSERVE;
    136112  if (pointer != NULL) {
    137113    atom *walker = new atom(pointer);
     
    143119      NoNonHydrogen++;
    144120    AtomCount++;
    145     retval=walker;
    146   }
    147   return retval;
     121    return walker;
     122  } else
     123    return NULL;
    148124};
    149125
     
    184160bool molecule::AddHydrogenReplacementAtom(bond *TopBond, atom *BottomOrigin, atom *TopOrigin, atom *TopReplacement, bool IsAngstroem)
    185161{
    186   bool AllWentWell = true;    // flag gathering the boolean return value of molecule::AddAtom and other functions, as return value on exit
    187   OBSERVE;
    188162  double bondlength;  // bond length of the bond to be replaced/cut
    189163  double bondangle;  // bond angle of the bond to be replaced/cut
    190164  double BondRescale;   // rescale value for the hydrogen bond length
     165  bool AllWentWell = true;    // flag gathering the boolean return value of molecule::AddAtom and other functions, as return value on exit
    191166  bond *FirstBond = NULL, *SecondBond = NULL; // Other bonds in double bond case to determine "other" plane
    192167  atom *FirstOtherAtom = NULL, *SecondOtherAtom = NULL, *ThirdOtherAtom = NULL; // pointer to hydrogen atoms to be added
     
    450425bool molecule::AddXYZFile(string filename)
    451426{
    452 
    453427  istringstream *input = NULL;
    454428  int NumberOfAtoms = 0; // atom number in xyz read
     
    464438    return false;
    465439
    466   OBSERVE;
    467440  getline(xyzfile,line,'\n'); // Read numer of atoms in file
    468441  input = new istringstream(line);
  • src/molecule.hpp

    rb1d8092 r7ba324  
    3333#include "tesselation.hpp"
    3434#include "Patterns/Observer.hpp"
    35 #include "Patterns/Cacheable.hpp"
    3635
    3736/****************************************** forward declarations *****************************/
     
    106105    char name[MAXSTRINGSIZE];         //!< arbitrary name
    107106
    108   private:
    109     Cacheable<string> formula;
    110 
    111107public:
    112108  molecule(const periodentafel * const teil);
     
    116112  const std::string getName();
    117113  void setName(const std::string);
    118   const std::string getFormula();
    119   std::string calcFormula();
    120114
    121115  // re-definition of virtual functions from PointCloud
  • src/moleculelist.cpp

    rb1d8092 r7ba324  
    5050void MoleculeListClass::insert(molecule *mol)
    5151{
    52   OBSERVE;
     52  START_OBSERVER;
    5353  mol->IndexNr = MaxIndex++;
    5454  ListOfMolecules.push_back(mol);
    5555  mol->signOn(this);
     56  FINISH_OBSERVER;
    5657};
    5758
     
    891892
    892893void MoleculeListClass::createNewMolecule(periodentafel *periode) {
    893   OBSERVE;
     894  START_OBSERVER;
    894895  molecule *mol = NULL;
    895896  mol = new molecule(periode);
    896897  insert(mol);
     898  FINISH_OBSERVER;
    897899};
    898900
  • src/unittests/Makefile.am

    rb1d8092 r7ba324  
    2929  VectorUnitTest \
    3030  ObserverTest \
    31   CacheableTest \
    32   DescriptorUnittest \
    33   ${MENUTESTS} 
    34    
     31  ${MENUTESTS}
     32
     33 
    3534check_PROGRAMS = $(TESTS)
    3635noinst_PROGRAMS = $(TESTS)
    3736
    38 GSLLIBS = ../libgslwrapper.a
    39 ALLLIBS = ../libmolecuilder.a ${GSLLIBS} $(BOOST_LIB) ${BOOST_THREAD_LIB}
    40 
    4137ActOnAllUnitTest_SOURCES = ../test/ActOnAllTest.hpp ActOnAllUnitTest.cpp ActOnAllUnitTest.hpp
    42 ActOnAllUnitTest_LDADD = ${ALLLIBS}
     38ActOnAllUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    4339
    4440AnalysisBondsUnitTests_SOURCES = analysisbondsunittest.cpp analysisbondsunittest.hpp
    45 AnalysisBondsUnitTests_LDADD = ${ALLLIBS}
     41AnalysisBondsUnitTests_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    4642
    4743AnalysisCorrelationToPointUnitTest_SOURCES = analysis_correlation.hpp AnalysisCorrelationToPointUnitTest.cpp AnalysisCorrelationToPointUnitTest.hpp
    48 AnalysisCorrelationToPointUnitTest_LDADD = ${ALLLIBS}
     44AnalysisCorrelationToPointUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    4945
    5046AnalysisCorrelationToSurfaceUnitTest_SOURCES = analysis_correlation.hpp AnalysisCorrelationToSurfaceUnitTest.cpp AnalysisCorrelationToSurfaceUnitTest.hpp
    51 AnalysisCorrelationToSurfaceUnitTest_LDADD = ${ALLLIBS}
     47AnalysisCorrelationToSurfaceUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    5248
    5349AnalysisPairCorrelationUnitTest_SOURCES = analysis_correlation.hpp AnalysisPairCorrelationUnitTest.cpp AnalysisPairCorrelationUnitTest.hpp
    54 AnalysisPairCorrelationUnitTest_LDADD = ${ALLLIBS}
     50AnalysisPairCorrelationUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    5551
    5652BondGraphUnitTest_SOURCES = bondgraphunittest.cpp bondgraphunittest.hpp
    57 BondGraphUnitTest_LDADD = ${ALLLIBS}
     53BondGraphUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    5854
    5955GSLMatrixSymmetricUnitTest_SOURCES = gslmatrixsymmetricunittest.cpp gslmatrixsymmetricunittest.hpp
    60 GSLMatrixSymmetricUnitTest_LDADD = ${GSLLIBS}
     56GSLMatrixSymmetricUnitTest_LDADD = ../libgslwrapper.a
    6157
    6258GSLMatrixUnitTest_SOURCES = gslmatrixunittest.cpp gslmatrixunittest.hpp
    63 GSLMatrixUnitTest_LDADD = ${GSLLIBS}
     59GSLMatrixUnitTest_LDADD = ../libgslwrapper.a
    6460
    6561GSLVectorUnitTest_SOURCES = gslvectorunittest.cpp gslvectorunittest.hpp
    66 GSLVectorUnitTest_LDADD = ${GSLLIBS}
     62GSLVectorUnitTest_LDADD = ../libgslwrapper.a
    6763
    6864InfoUnitTest_SOURCES = infounittest.cpp infounittest.hpp
    69 InfoUnitTest_LDADD = ${ALLLIBS}
     65InfoUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    7066
    7167LinearSystemOfEquationsUnitTest_SOURCES = linearsystemofequationsunittest.cpp linearsystemofequationsunittest.hpp
    72 LinearSystemOfEquationsUnitTest_LDADD = ${ALLLIBS}
     68LinearSystemOfEquationsUnitTest_LDADD = ../libgslwrapper.a ../libmolecuilder.a
    7369
    7470ListOfBondsUnitTest_SOURCES = listofbondsunittest.cpp listofbondsunittest.hpp
    75 ListOfBondsUnitTest_LDADD = ${ALLLIBS}
     71ListOfBondsUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    7672
    7773LogUnitTest_SOURCES = logunittest.cpp logunittest.hpp
    78 LogUnitTest_LDADD = ${ALLLIBS}
     74LogUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    7975
    8076MemoryAllocatorUnitTest_SOURCES = memoryallocatorunittest.cpp memoryallocatorunittest.hpp
    81 MemoryAllocatorUnitTest_LDADD = ${ALLLIBS}
     77MemoryAllocatorUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    8278
    8379MemoryUsageObserverUnitTest_SOURCES = memoryusageobserverunittest.cpp memoryusageobserverunittest.hpp
    84 MemoryUsageObserverUnitTest_LDADD = ${ALLLIBS}
     80MemoryUsageObserverUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    8581
    8682StackClassUnitTest_SOURCES = stackclassunittest.cpp stackclassunittest.hpp
    87 StackClassUnitTest_LDADD = ${ALLLIBS}
     83StackClassUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    8884
    8985TesselationUnitTest_SOURCES = tesselationunittest.cpp tesselationunittest.hpp
    90 TesselationUnitTest_LDADD = ${ALLLIBS}
     86TesselationUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    9187
    9288Tesselation_BoundaryTriangleUnitTest_SOURCES = tesselation_boundarytriangleunittest.cpp tesselation_boundarytriangleunittest.hpp
    93 Tesselation_BoundaryTriangleUnitTest_LDADD = ${ALLLIBS}
     89Tesselation_BoundaryTriangleUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    9490
    9591Tesselation_InOutsideUnitTest_SOURCES = tesselation_insideoutsideunittest.cpp tesselation_insideoutsideunittest.hpp
    96 Tesselation_InOutsideUnitTest_LDADD = ${ALLLIBS}
     92Tesselation_InOutsideUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    9793
    9894VectorUnitTest_SOURCES = vectorunittest.cpp vectorunittest.hpp
    99 VectorUnitTest_LDADD = ${ALLLIBS}
     95VectorUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a
    10096
    10197ActionSequenceTest_SOURCES = ActionSequenceTest.cpp ActionSequenceTest.hpp
    102 ActionSequenceTest_LDADD = ${ALLLIBS} ../libmenu.a
     98ActionSequenceTest_LDADD = ../libmolecuilder.a ../libmenu.a
    10399
    104100ObserverTest_SOURCES = ObserverTest.cpp ObserverTest.hpp
    105 ObserverTest_LDADD = ${ALLLIBS}
    106 
    107 CacheableTest_SOURCES = CacheableTest.cpp CacheableTest.hpp
    108 CacheableTest_LDADD = ${ALLLIBS}
    109 
    110 DescriptorUnittest_SOURCES = DescriptorUnittest.cpp DescriptorUnittest.hpp
    111 DescriptorUnittest_LDADD = ${ALLLIBS}
     101ObserverTest_LDADD = ../libmolecuilder.a
    112102
    113103#AUTOMAKE_OPTIONS = parallel-tests
  • src/unittests/ObserverTest.cpp

    rb1d8092 r7ba324  
    3939public:
    4040  void changeMethod() {
    41     OBSERVE;
    42     int i;
    43     i++;
     41    START_OBSERVER;
     42    int i;
     43    i++;
     44    FINISH_OBSERVER;
    4445  }
    4546};
     
    4849public:
    4950  void changeMethod1() {
    50     OBSERVE;
    51     int i;
    52     i++;
     51    START_OBSERVER;
     52    int i;
     53    i++;
     54    FINISH_OBSERVER;
    5355  }
    5456
    5557  void changeMethod2() {
    56     OBSERVE;
     58    START_OBSERVER;
    5759    int i;
    5860    i++;
    5961    changeMethod1();
     62    FINISH_OBSERVER;
    6063  }
    6164};
     
    7174  }
    7275  void changeMethod() {
    73     OBSERVE;
     76    START_OBSERVER;
    7477    int i;
    7578    i++;
    7679    subObservable->changeMethod();
     80    FINISH_OBSERVER;
    7781  }
    7882  SimpleObservable *subObservable;
Note: See TracChangeset for help on using the changeset viewer.