Changeset 01d28a for molecuilder/src
- Timestamp:
- Feb 19, 2010, 2:31:56 PM (16 years ago)
- Children:
- 7bfc19
- Parents:
- 9ef76a
- Location:
- molecuilder/src
- Files:
-
- 5 added
- 5 edited
-
Actions/AtomsCalculation.hpp (added)
-
Actions/AtomsCalculation_impl.hpp (added)
-
Actions/Calculation.hpp (modified) (2 diffs)
-
Actions/Calculation_impl.hpp (modified) (5 diffs)
-
World.hpp (modified) (2 diffs)
-
World_calculations.hpp (added)
-
unittests/Makefile.am (modified) (2 diffs)
-
unittests/atomsCalculationTest.cpp (added)
-
unittests/atomsCalculationTest.hpp (added)
-
unittests/manipulateAtomsTest.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/Actions/Calculation.hpp
r9ef76a r01d28a 12 12 13 13 template<typename T> 14 class Calculation : public Process14 class Calculation : public Process 15 15 { 16 16 public: … … 22 22 virtual bool canUndo(); 23 23 24 virtual void calc();24 virtual T operator()(); 25 25 virtual bool hasResult(); 26 26 virtual T getResult(); -
molecuilder/src/Actions/Calculation_impl.hpp
r9ef76a r01d28a 9 9 #define CALCULATION_IMPL_HPP_ 10 10 11 #include "Actions/Calculation.hpp" 12 11 13 #include <cassert> 12 14 13 15 template<typename T> 14 Calculation<T>::Calculation(int _maxSteps, std::string _name, bool _doRegister =true) :16 Calculation<T>::Calculation(int _maxSteps, std::string _name, bool _doRegister) : 15 17 Process(_maxSteps,_name,_doRegister), 16 18 done(false), … … 20 22 template<typename T> 21 23 Calculation<T>::~Calculation() 22 {} 24 { 25 delete result; 26 } 23 27 24 28 // methods inherited from Action … … 26 30 template<typename T> 27 31 void Calculation<T>::call(){ 28 calc(); 32 reset(); 33 (*this)(); 29 34 } 30 35 … … 41 46 42 47 template<typename T> 43 void Calculation<T>::calc(){48 T Calculation<T>::operator()(){ 44 49 if(!done){ 45 50 result = doCalc(); 46 51 done = true; 47 52 } 53 return *result; 48 54 } 49 55 … … 62 68 void Calculation<T>::reset(){ 63 69 done = false; 70 delete result; 64 71 result = 0; 65 72 } -
molecuilder/src/World.hpp
r9ef76a r01d28a 28 28 class AtomDescriptor_impl; 29 29 class ManipulateAtomsProcess; 30 template<typename T> 31 class AtomsCalculation; 30 32 31 33 class World : public Observable 32 34 { 35 // necessary for coupling with descriptors 33 36 friend class AtomDescriptor_impl; 34 37 friend class AtomDescriptor; 35 38 39 // Actions, calculations etc associated with the World 36 40 friend class ManipulateAtomsProcess; 41 template<typename> friend class AtomsCalculation; 37 42 38 43 typedef std::map<int,atom*> AtomList; … … 44 49 atom* getAtom(AtomDescriptor descriptor); 45 50 std::vector<atom*> getAllAtoms(AtomDescriptor descriptor); 51 52 template<typename T> 53 AtomsCalculation<T>* calcOnAtoms(boost::function<T(atom*)>,std::string,AtomDescriptor); 54 46 55 int numAtoms(); 47 56 int numMolecules(); -
molecuilder/src/unittests/Makefile.am
r9ef76a r01d28a 31 31 DescriptorUnittest \ 32 32 manipulateAtomsTest \ 33 atomsCalculationTest \ 33 34 ${MENUTESTS} 34 35 … … 115 116 manipulateAtomsTest_LDADD = ${ALLLIBS} 116 117 118 atomsCalculationTest_SOURCES = atomsCalculationTest.cpp atomsCalculationTest.hpp 119 atomsCalculationTest_LDADD = ${ALLLIBS} 120 117 121 #AUTOMAKE_OPTIONS = parallel-tests 118 122 -
molecuilder/src/unittests/manipulateAtomsTest.cpp
r9ef76a r01d28a 7 7 8 8 #include "manipulateAtomsTest.hpp" 9 10 #include "DescriptorUnittest.hpp"11 9 12 10 #include <cppunit/CompilerOutputter.h>
Note:
See TracChangeset
for help on using the changeset viewer.
