Changeset 10aee4 for src/Actions/ActionSequence.cpp
- Timestamp:
- Aug 5, 2015, 7:12:24 AM (9 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, 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:
- c307ba
- Parents:
- 94232b
- git-author:
- Frederik Heber <heber@…> (08/03/15 09:25:02)
- git-committer:
- Frederik Heber <heber@…> (08/05/15 07:12:24)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/ActionSequence.cpp
r94232b r10aee4 22 22 23 23 /* 24 * ActionSequen ze.cpp24 * ActionSequence.cpp 25 25 * 26 26 * Created on: Dec 17, 2009 … … 60 60 61 61 ActionSequence::~ActionSequence() 62 {} 63 64 65 void ActionSequence::addAction(Action* _action){ 62 { 63 for (actionSet::iterator iter = actions.begin(); !actions.empty(); iter = actions.begin()) { 64 delete *iter; 65 actions.erase(iter); 66 } 67 } 68 69 70 void ActionSequence::addAction(Action* _action) 71 { 72 // actions are already clone on push as ActionRegistry hands out const refs only 66 73 actions.push_back(_action); 67 74 } 68 75 69 bool ActionSequence::removeAction(const std::string &name){ 76 bool ActionSequence::removeAction(const std::string &name) 77 { 70 78 actionSet::iterator it=actions.begin(); 71 79 for(; it!=actions.end(); it++){ 72 80 if ((*it)->getName() == name) { 81 delete *it; 73 82 actions.erase(it); 74 83 break; … … 78 87 } 79 88 80 Action* ActionSequence::removeLastAction(){ 89 Action* ActionSequence::removeLastAction() 90 { 81 91 if(actions.empty()) { 82 92 return 0; … … 92 102 // this method is used outside the ActionModule 93 103 // Each action registers itself with the history 94 Dialog* ActionSequence::fillAllDialogs(Dialog *dialog){ 104 Dialog* ActionSequence::fillAllDialogs(Dialog *dialog) 105 { 95 106 for(actionSet::iterator it=actions.begin(); it!=actions.end(); it++){ 96 107 dialog = (*it)->fillDialog(dialog); … … 101 112 // this method is used outside the ActionModule 102 113 // Each action registers itself with the history 103 void ActionSequence::callAll(){ 114 void ActionSequence::callAll() 115 { 104 116 for (size_t i=0;i<loop;++i) 105 117 for(actionSet::iterator it=actions.begin(); it!=actions.end(); it++){ … … 113 125 // In this case only the makro Action should be registered and 114 126 // handle the states 115 ActionSequence::stateSet ActionSequence::callAll(bool){ 127 ActionSequence::stateSet ActionSequence::callAll(bool) 128 { 116 129 stateSet states; 117 130 for (size_t i=0;i<loop;++i) … … 127 140 } 128 141 129 ActionSequence::stateSet ActionSequence::undoAll(stateSet states){ 142 ActionSequence::stateSet ActionSequence::undoAll(stateSet states) 143 { 130 144 ASSERT(canUndo(),"Trying to undo a sequence that contains methods that can't be undone"); 131 145 stateSet res; … … 147 161 } 148 162 149 ActionSequence::stateSet ActionSequence::redoAll(stateSet states){ 163 ActionSequence::stateSet ActionSequence::redoAll(stateSet states) 164 { 150 165 stateSet res; 151 166 actionSet::iterator actionIt = actions.begin(); … … 164 179 } 165 180 166 bool ActionSequence::canUndo(){ 181 bool ActionSequence::canUndo() 182 { 167 183 bool canUndo=true; 168 184 for(std::deque<Action*>::iterator it=actions.begin(); it!=actions.end(); ++it){ … … 174 190 } 175 191 176 bool ActionSequence::shouldUndo(){ 192 bool ActionSequence::shouldUndo() 193 { 177 194 bool shouldUndo = false; 178 195 for(std::deque<Action*>::iterator it=actions.begin();it!=actions.end();++it){
Note:
See TracChangeset
for help on using the changeset viewer.