- Timestamp:
- Feb 14, 2016, 12:34:30 PM (10 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, Candidate_v1.7.0, Candidate_v1.7.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- bcf9cd
- Parents:
- 59f1bc
- git-author:
- Frederik Heber <heber@…> (01/08/16 13:53:48)
- git-committer:
- Frederik Heber <heber@…> (02/14/16 12:34:30)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/InstanceBoard/ObservedValuesContainer.hpp
r59f1bc r23221f 87 87 88 88 private: 89 /** \note CountedObservedValues_t needs to contain a list in the second argument90 * as the ObservedValuesContainer may fall behind when a single atom is created91 * and destroyed a number of times in a row (e.g. in the undo/redo cases). This92 * problem is inherent because on the one hand we keep the QtObservedAtom alive93 * till the last moment, i.e. till the GUI does not need it anymore where the94 * original instance may long have been removed from the World. On the other hand95 * we instantiate the e.g. QtObservedAtom as soon as the observed atom is created.96 */97 89 98 /** Structure to contain the sequence of created observed memories. 99 * 100 * \note QtGUI may lag behind the creation/destruction of observed instances a 101 * lot but one after the other must be served. Here, we keep an additional 102 * iterator that indicates the current instance to be served. 103 */ 104 struct RefCountedObserved 105 { 106 typedef std::pair<typename T::ptr, size_t> Value_t; 107 typedef std::deque<Value_t> Values_t; 108 109 /** Default cstor of RefCountedObservedValues. 110 * 111 * Make sure that currentvalue has some sensible default value. 112 */ 113 RefCountedObserved() : 114 tobedestroyed(values.end()), 115 currentvalue(values.end()) 116 {} 117 118 /** Default copy cstor of RefCountedObservedValues. 119 * 120 * \param _instance instance to copy 121 */ 122 RefCountedObserved(const RefCountedObserved & _instance) : 123 values(_instance.values), 124 tobedestroyed(values.begin()), 125 currentvalue(values.begin()) 126 {} 127 128 /** Cstor of RefCountedObservedValues. 129 * 130 * Make sure that currentvalue has some sensible default value. 131 * 132 * \param _value initial value for the list 133 */ 134 RefCountedObserved(Value_t _value) : 135 values(1, _value), 136 tobedestroyed(values.begin()), 137 currentvalue(values.begin()) 138 {} 139 140 bool empty() const 141 { 142 return values.empty(); 143 } 144 145 void push_back(Value_t _value) 146 { 147 values.push_back(_value); 148 if (currentvalue == values.end()) 149 currentvalue = values.end()--; 150 if (tobedestroyed == values.end()) 151 tobedestroyed = currentvalue; 152 } 153 154 Value_t& getCurrentValue() const 155 { 156 ASSERT (currentvalue != values.end(), 157 "RefCountedObservedValues::getCurrentValue() - cannot get, no values present."); 158 return *currentvalue; 159 } 160 161 Value_t& getEraseCandidate() const 162 { 163 ASSERT (tobedestroyed != values.end(), 164 "RefCountedObservedValues::getCurrentValue() - cannot get, no values present."); 165 return *tobedestroyed; 166 } 167 168 void eraseCurrentValue() 169 { 170 ASSERT (tobedestroyed != values.end(), 171 "RefCountedObservedValues::eraseCurrentValue() - cannot erase, no values present."); 172 if (tobedestroyed == currentvalue) 173 ++currentvalue; 174 values.erase(tobedestroyed); 175 tobedestroyed = currentvalue; 176 // removal of this instance when both iterators point to end is done inside QtObservedInstanceBoard 177 } 178 179 //!> set of values 180 Values_t values; 181 //!> iterator on the value that is next gonna be destroyed 182 typename Values_t::iterator tobedestroyed; 183 //!> iterator on the current value that is served on get 184 typename Values_t::iterator currentvalue; 185 }; 186 187 typedef std::map<id, RefCountedObserved > CountedObservedValues_t; 90 typedef std::map<id, typename T::ptr > CountedObservedValues_t; 188 91 //!> internal vector of observed values 189 92 CountedObservedValues_t ObservedValues; 190 93 191 94 //!> typedef for the set with ids to be erase 192 typedef std::set<id> Marked ForErase_t;95 typedef std::set<id> MarkedSet_t; 193 96 194 97 //!> marks ids marked for erase (i.e. all subjectKilled() received) 195 MarkedForErase_t MarkedForErase; 98 MarkedSet_t MarkedForErase; 99 100 //!> marks ids marked as connected (i.e. for later subjectKilled() received) 101 MarkedSet_t MarkedForConnected; 196 102 197 103 //!> name used in describing the instance type … … 214 120 * \return true - no more signOn()s, false - else 215 121 */ 216 bool check RefCount(const id _id) const;122 bool checkMarkedForConnected(const id _id) const; 217 123 218 124 /** Internal function to check whether the vector of ObservedValue's
Note:
See TracChangeset
for help on using the changeset viewer.
