Ignore:
Timestamp:
Feb 19, 2010, 2:31:56 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
Children:
7bfc19
Parents:
9ef76a
Message:

Added templates that allow arbitrary calculations on atoms to be mapped to sets of Atoms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/Actions/Calculation_impl.hpp

    r9ef76a r01d28a  
    99#define CALCULATION_IMPL_HPP_
    1010
     11#include "Actions/Calculation.hpp"
     12
    1113#include <cassert>
    1214
    1315template<typename T>
    14 Calculation<T>::Calculation(int _maxSteps, std::string _name, bool _doRegister=true) :
     16Calculation<T>::Calculation(int _maxSteps, std::string _name, bool _doRegister) :
    1517  Process(_maxSteps,_name,_doRegister),
    1618  done(false),
     
    2022template<typename T>
    2123Calculation<T>::~Calculation()
    22 {}
     24{
     25  delete result;
     26}
    2327
    2428// methods inherited from Action
     
    2630template<typename T>
    2731void Calculation<T>::call(){
    28   calc();
     32  reset();
     33  (*this)();
    2934}
    3035
     
    4146
    4247template<typename T>
    43 void Calculation<T>::calc(){
     48T Calculation<T>::operator()(){
    4449  if(!done){
    4550    result = doCalc();
    4651    done = true;
    4752  }
     53  return *result;
    4854}
    4955
     
    6268void Calculation<T>::reset(){
    6369  done = false;
     70  delete result;
    6471  result = 0;
    6572}
Note: See TracChangeset for help on using the changeset viewer.