Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Formula.cpp

    r426f2a rbcf653  
     1/*
     2 * Project: MoleCuilder
     3 * Description: creates and alters molecular systems
     4 * Copyright (C)  2010 University of Bonn. All rights reserved.
     5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
     6 */
     7
    18/*
    29 * Formula.cpp
     
    613 */
    714
     15// include config.h
     16#ifdef HAVE_CONFIG_H
     17#include <config.h>
     18#endif
     19
     20#include "Helpers/MemDebug.hpp"
     21
    822#include "Formula.hpp"
    923
     
    4761  for(const_iterator iter=end();iter!=begin();){
    4862    --iter;
    49     sstr << (*iter).first->symbol;
     63    sstr << (*iter).first->getSymbol();
    5064    if((*iter).second>1)
    5165      sstr << (*iter).second;
     
    146160
    147161bool Formula::hasElement(const string &shorthand) const{
    148   element * element = World::getInstance().getPeriode()->FindElement(shorthand);
     162  const element * element = World::getInstance().getPeriode()->FindElement(shorthand);
    149163  return hasElement(element);
    150164}
     
    167181
    168182void Formula::operator+=(const string &shorthand){
    169   element * element = World::getInstance().getPeriode()->FindElement(shorthand);
     183  const element * element = World::getInstance().getPeriode()->FindElement(shorthand);
    170184  operator+=(element);
    171185}
     
    198212
    199213void Formula::operator-=(const string &shorthand){
    200   element * element = World::getInstance().getPeriode()->FindElement(shorthand);
     214  const element * element = World::getInstance().getPeriode()->FindElement(shorthand);
    201215  operator-=(element);
    202216}
     
    220234
    221235void Formula::addElements(const string &shorthand,unsigned int count){
    222   element * element = World::getInstance().getPeriode()->FindElement(shorthand);
     236  const element * element = World::getInstance().getPeriode()->FindElement(shorthand);
    223237  addElements(element,count);
    224238}
     
    252266
    253267const unsigned int Formula::operator[](string shorthand) const{
    254   element * element = World::getInstance().getPeriode()->FindElement(shorthand);
     268  const element * element = World::getInstance().getPeriode()->FindElement(shorthand);
    255269  return operator[](element);
    256270}
     
    380394result_type
    381395Formula::_iterator<result_type>::operator*(){
    382   element *element = World::getInstance().getPeriode()->FindElement(pos+1);
     396  const element *element = World::getInstance().getPeriode()->FindElement(pos+1);
    383397  ASSERT(element,"Element with position of iterator not found");
    384398  return make_pair(element,(*set)[pos]);
     
    390404  // no one can keep this value around, so a static is ok to avoid temporaries
    391405  static value_type value=make_pair(reinterpret_cast<element*>(0),0); // no default constructor for std::pair
    392   element *element = World::getInstance().getPeriode()->FindElement(pos+1);
     406  const element *element = World::getInstance().getPeriode()->FindElement(pos+1);
    393407  ASSERT(element,"Element with position of iterator not found");
    394408  value = make_pair(element,(*set)[pos]);
Note: See TracChangeset for help on using the changeset viewer.