Changeset 70fee0 for ThirdParty/CodePatterns
- Timestamp:
- Jul 3, 2017, 3:00:00 PM (7 years ago)
- Branches:
- Action_Thermostats, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, EmpiricalPotential_contain_HomologyGraph_documentation, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, Fix_Verbose_Codepatterns, ForceAnnealing_oldresults, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, IndependentFragmentGrids_IntegrationTest, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, StoppableMakroAction, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps
- Children:
- 4dfe724
- Parents:
- 8e9217
- git-author:
- Frederik Heber <heber@…> (04/07/17 17:47:46)
- git-committer:
- Frederik Heber <frederik.heber@…> (07/03/17 15:00:00)
- Location:
- ThirdParty/CodePatterns/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ThirdParty/CodePatterns/src/CodePatterns/ObservedValue.hpp
r8e9217 r70fee0 86 86 virtual void subjectKilled(Observable *publisher); 87 87 88 void forceUpdate(); 89 88 90 const T& get() const; 89 91 … … 178 180 179 181 template <typename T> 182 void ObservedValue<T>::forceUpdate() 183 { 184 boost::lock_guard<boost::recursive_mutex> guard(valueLock); 185 value = recalcMethod(); 186 } 187 188 template <typename T> 180 189 void ObservedValue<T>::update(Observable *publisher) 181 190 { -
ThirdParty/CodePatterns/src/Patterns/unittests/ObservedValueUnitTest.cpp
r8e9217 r70fee0 70 70 CPPUNIT_ASSERT_EQUAL( true, YChange_numbers->hasRecalced); 71 71 CPPUNIT_ASSERT_EQUAL( 11, (YChange_numbers->sum).get()); 72 73 numbers->hasRecalced=false; 74 numbers->sum.forceUpdate(); 75 CPPUNIT_ASSERT_EQUAL( true, numbers->hasRecalced); 72 76 }
Note:
See TracChangeset
for help on using the changeset viewer.