Ignore:
Timestamp:
May 18, 2010, 3:20:52 PM (15 years ago)
Author:
Frederik Heber <heber@…>
Children:
108d38
Parents:
7a6fd9
Message:

"-e <db path>" not necessary anymore.

Removed necessity of specifying path to databases (this was one check of molecuilder/test/testsuite.at which cannot be fulfilled anymore with boost::program_options)
For this to work a great number of small changes have been necessary:

class periodentafel:

  • all .db files merged into const char * arrays in elements_db.cpp
  • periodentafel rewritten:
  • FindElement(), AskElement() and EnterElement return element * const instead of const element * (i.e. the contents of the pointer is const (the element) not the pointer itself which is very vexatious (i.e. FindElement() yields const element * which can subsequently not be used for RemoveElement(), ...)
  • parsedElems is not needed anymore. Instead we operate on map elements directly
  • new unittest periodentafelTest which is made friend of periodentafel to be able to access private loading functions directly

A number of unit tests had to be changed (all that create elements during setUp() which is now unnecessary)

Some of the analysis_bonds function's signatures were changed in the process:

Finally, the respective tests are removed from molecuilder/tests/testsuite.at.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/periodentafel.hpp

    r7a6fd9 r06f141  
    1313#include <iterator>
    1414
     15#include "unittests/periodentafelTest.hpp"
    1516#include "defs.hpp"
    1617#include "types.hpp"
     
    2728class periodentafel {
    2829  /******* Types *********/
     30  friend class periodentafelTest;
    2931  private:
    3032    typedef std::map<atomicNumber_t,element*> elementSet;
     
    4345  iterator AddElement(element * const pointer);
    4446  void RemoveElement(element * const pointer);
     47  void RemoveElement(atomicNumber_t);
    4548  void CleanupPeriodtable();
    46   const element *FindElement(atomicNumber_t) const;
    47   const element *FindElement(const char * const shorthand) const;
    48   const element *AskElement() const;
    49   const element *EnterElement();
     49  element * const FindElement(atomicNumber_t) const;
     50  element * const FindElement(const char * const shorthand) const;
     51  element * const AskElement() const;
     52  element * const EnterElement();
    5053
    5154  const_iterator begin();
     
    5962
    6063  private:
     64
     65  bool LoadElementsDatabase(std::istream *input);
     66  bool LoadValenceDatabase(std::istream *input);
     67  bool LoadOrbitalsDatabase(std::istream *input);
     68  bool LoadHBondAngleDatabase(std::istream *input);
     69  bool LoadHBondLengthsDatabase(std::istream *input);
     70
    6171    elementSet elements;
    6272};
Note: See TracChangeset for help on using the changeset viewer.