Changeset 126867
- Timestamp:
- Sep 19, 2013, 8:23:52 PM (11 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:
- 05c989
- Parents:
- d649b7
- git-author:
- Frederik Heber <heber@…> (08/20/13 15:45:30)
- git-committer:
- Frederik Heber <heber@…> (09/19/13 20:23:52)
- Location:
- src
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Action.cpp
rd649b7 r126867 75 75 ActionState::ptr Action::failure; 76 76 77 Action::Action(const ActionTrait &_Traits, ActionRegistry * const _AR) : 78 Traits(_Traits), 79 AR(_AR) 80 { 81 // register with ActionRegistry 82 if(AR != NULL) { 83 AR->registerInstance(this); 84 } 85 77 Action::Action(const ActionTrait &_Traits) : 78 Traits(_Traits) 79 { 86 80 // register with OptionRegistry 87 81 for (ActionTrait::options_const_iterator optioniter = Traits.getBeginIter(); … … 128 122 Action::~Action() 129 123 { 130 // unregister us if still registered131 if (AR != NULL)132 AR->unregisterInstance(this);133 134 124 for (ActionTrait::options_const_iterator optioniter = Traits.getBeginIter(); 135 125 optioniter != Traits.getEndIter(); -
src/Actions/Action.hpp
rd649b7 r126867 25 25 26 26 // forward declaration 27 template <typename T> class Registry; 27 28 28 29 namespace MoleCuilder { 30 class ActionHistory; 29 31 class ActionRegistry; 30 32 class ActionSequence; 31 33 } 34 class ActionSequenceTest; 32 35 class Dialog; 33 36 … … 80 83 class Action 81 84 { 82 friend class ActionSequence; 83 friend class ActionHistory; 85 friend class ActionHistory; 86 friend class ActionRegistry; 87 friend class ActionSequence; 88 template <typename T> friend class ::Registry; 89 //!> TextMenu needs to instantiate some specific Actions, grant access to cstor 90 friend class TextMenu; 91 92 // some unit tests on Actions 93 friend class ::ActionSequenceTest; 84 94 public: 85 95 86 96 enum QueryOptions {Interactive, NonInteractive}; 87 97 98 protected: 88 99 /** 89 100 * Standard constructor of Action Base class … … 97 108 * 98 109 * \param Traits information class to this action 99 * \param _AR pointer to ActionRegistry to register, NULL - do not register 100 */ 101 Action(const ActionTrait &_Traits, ActionRegistry * const _AR = NULL); 110 */ 111 Action(const ActionTrait &_Traits); 102 112 virtual ~Action(); 103 113 114 public: 104 115 /** 105 116 * This method is used to call an action. The basic operations for the Action … … 163 174 const ActionTrait Traits; 164 175 165 /** Action is registered with an ActionRegistry and stores its pointer internally.166 *167 */168 ActionRegistry* const AR;169 170 176 protected: 171 177 /** Removes the static entities Action::success and Action::failure. -
src/Actions/ActionQueue.cpp
rd649b7 r126867 69 69 } 70 70 71 void ActionQueue::registerAction(Action *_action) 72 { 73 AR->registerInstance(_action); 74 } 75 71 76 const ActionTrait& ActionQueue::getActionsTrait(const std::string &name) const 72 77 { -
src/Actions/ActionQueue.hpp
rd649b7 r126867 55 55 bool isActionKnownByName(const std::string &name) const; 56 56 57 /** Register an Action with the ActionRegistry. 58 * 59 * \param _action action to add 60 */ 61 void registerAction(Action *_action); 62 57 63 /** Returns the vector with the tokens of all currently known Actions. 58 64 * … … 67 73 */ 68 74 const ActionTrait& getActionsTrait(const std::string &name) const; 69 70 /** Getter function for the ActionRegistry for transitional purpose.71 *72 * \return ref to internal ActionRegistry73 */74 ActionRegistry& getActionRegistry() {75 return *AR;76 }77 75 78 76 /** Undoes last called Action. -
src/Actions/Action_impl_pre.hpp
rd649b7 r126867 234 234 // =========== constructor =========== 235 235 ACTION::ACTION () : 236 Action(ActionTraits< ACTION >() , NULL)236 Action(ActionTraits< ACTION >()) 237 237 {} 238 238 -
src/Actions/AtomsCalculation_impl.hpp
rd649b7 r126867 22 22 template<typename T> 23 23 AtomsCalculation<T>::AtomsCalculation(boost::function<T(atom*)> _op,const ActionTrait &_trait,AtomDescriptor _descr) : 24 Calculation<std::vector<T> >(0,_trait ,NULL),24 Calculation<std::vector<T> >(0,_trait), 25 25 descr(_descr), 26 26 op(_op) -
src/Actions/Calculation.hpp
rd649b7 r126867 30 30 { 31 31 public: 32 Calculation(int _maxSteps, const ActionTrait &_trait , ActionRegistry * const _AR);32 Calculation(int _maxSteps, const ActionTrait &_trait); 33 33 virtual ~Calculation(); 34 34 -
src/Actions/Calculation_impl.hpp
rd649b7 r126867 22 22 23 23 template<typename T> 24 Calculation<T>::Calculation(int _maxSteps, const ActionTrait &_trait , ActionRegistry * const _AR) :25 Process(_maxSteps,_trait ,_AR),24 Calculation<T>::Calculation(int _maxSteps, const ActionTrait &_trait) : 25 Process(_maxSteps,_trait), 26 26 result(0), 27 27 done(false) -
src/Actions/ErrorAction.cpp
rd649b7 r126867 44 44 using namespace MoleCuilder; 45 45 46 ErrorAction::ErrorAction(const ActionTrait &_trait,const char * _errorMsg , ActionRegistry * const _AR) :47 Action(_trait ,_AR),46 ErrorAction::ErrorAction(const ActionTrait &_trait,const char * _errorMsg) : 47 Action(_trait), 48 48 errorMsg(_errorMsg) 49 49 { -
src/Actions/ErrorAction.hpp
rd649b7 r126867 23 23 { 24 24 public: 25 ErrorAction(const ActionTrait &_trait,const char * _errorMsg , ActionRegistry * const _AR);25 ErrorAction(const ActionTrait &_trait,const char * _errorMsg); 26 26 virtual ~ErrorAction(); 27 27 -
src/Actions/GraphAction/SubgraphDissectionAction.cpp
rd649b7 r126867 78 78 79 79 GraphSubgraphDissectionAction::GraphSubgraphDissectionAction() : 80 MakroAction(ActionTraits< GraphSubgraphDissectionAction >(), actions , false)80 MakroAction(ActionTraits< GraphSubgraphDissectionAction >(), actions) 81 81 {} 82 82 -
src/Actions/MakroAction.cpp
rd649b7 r126867 61 61 }; 62 62 63 MakroAction::MakroAction(const ActionTrait &_trait,ActionSequence& _actions , ActionRegistry * const _AR) :64 Action(_trait,_AR),65 actions(_actions)63 MakroAction::MakroAction(const ActionTrait &_trait,ActionSequence& _actions) : 64 Action(_trait), 65 actions(_actions) 66 66 { 67 67 } -
src/Actions/MakroAction.hpp
rd649b7 r126867 31 31 { 32 32 public: 33 MakroAction(const ActionTrait &_trait,ActionSequence& _actions , ActionRegistry * const _AR=NULL);33 MakroAction(const ActionTrait &_trait,ActionSequence& _actions); 34 34 virtual ~MakroAction(); 35 35 -
src/Actions/MakroAction_impl_pre.hpp
rd649b7 r126867 235 235 // =========== constructor =========== 236 236 ACTION::ACTION () : 237 MakroAction(ActionTraits< ACTION >(), actions , NULL)237 MakroAction(ActionTraits< ACTION >(), actions) 238 238 {} 239 239 -
src/Actions/ManipulateAtomsProcess.cpp
rd649b7 r126867 47 47 boost::function<void(atom*)> _operation, 48 48 AtomDescriptor _descr, 49 const ActionTrait &_trait, 50 ActionRegistry * const _AR) : 51 Process(0,_trait,_AR), 49 const ActionTrait &_trait) : 50 Process(0,_trait), 52 51 descr(_descr), 53 52 operation(_operation) -
src/Actions/ManipulateAtomsProcess.hpp
rd649b7 r126867 30 30 { 31 31 public: 32 ManipulateAtomsProcess(boost::function<void(atom*)> _operation, AtomDescriptor descr,const ActionTrait &_trait ,ActionRegistry * const _AR);32 ManipulateAtomsProcess(boost::function<void(atom*)> _operation, AtomDescriptor descr,const ActionTrait &_trait); 33 33 virtual ~ManipulateAtomsProcess(); 34 34 -
src/Actions/MethodAction.cpp
rd649b7 r126867 44 44 using namespace MoleCuilder; 45 45 46 MethodAction::MethodAction(const ActionTrait &_trait,boost::function<void()> _executeMethod ,ActionRegistry * const _AR) :47 Action(_trait ,_AR),46 MethodAction::MethodAction(const ActionTrait &_trait,boost::function<void()> _executeMethod) : 47 Action(_trait), 48 48 executeMethod(_executeMethod) 49 49 { -
src/Actions/MethodAction.hpp
rd649b7 r126867 29 29 { 30 30 public: 31 MethodAction(const ActionTrait &_trait,boost::function<void()> _executeMethod ,ActionRegistry * const _AR);31 MethodAction(const ActionTrait &_trait,boost::function<void()> _executeMethod); 32 32 virtual ~MethodAction(); 33 33 virtual bool canUndo(); -
src/Actions/OptionRegistry.hpp
rd649b7 r126867 28 28 * 29 29 */ 30 class OptionRegistry : public Singleton<OptionRegistry>, public Registry<OptionTrait>30 class OptionRegistry : public Singleton<OptionRegistry>, public ::Registry<OptionTrait> 31 31 { 32 32 friend class Singleton<OptionRegistry>; -
src/Actions/Process.cpp
rd649b7 r126867 41 41 using namespace MoleCuilder; 42 42 43 Process::Process(int _maxSteps, const ActionTrait &_trait , ActionRegistry * const _AR) :44 Action(_trait ,_AR),43 Process::Process(int _maxSteps, const ActionTrait &_trait) : 44 Action(_trait), 45 45 Observable("Process"), 46 46 maxSteps(_maxSteps), -
src/Actions/Process.hpp
rd649b7 r126867 51 51 { 52 52 public: 53 Process(int _maxSteps, const ActionTrait &_trait , ActionRegistry * const _AR);53 Process(int _maxSteps, const ActionTrait &_trait); 54 54 virtual ~Process(); 55 55 -
src/Actions/Reaction.hpp
rd649b7 r126867 30 30 { 31 31 public: 32 Reaction(const ActionTrait &_trait , ActionRegistry * const _AR=NULL);32 Reaction(const ActionTrait &_trait); 33 33 virtual ~Reaction(); 34 34 -
src/Actions/Reaction_impl.hpp
rd649b7 r126867 23 23 24 24 template<typename T> 25 Reaction<T>::Reaction(const ActionTrait &_trait , ActionRegistry * const _AR) :26 Action(_trait ,_AR),25 Reaction<T>::Reaction(const ActionTrait &_trait) : 26 Action(_trait), 27 27 result(0), 28 28 done(false) -
src/Actions/Reaction_impl_pre.hpp
rd649b7 r126867 163 163 // =========== constructor =========== 164 164 REACTION::REACTION () : 165 Reaction< RETURNTYPE >(ActionTraits< REACTION >() , NULL)165 Reaction< RETURNTYPE >(ActionTraits< REACTION >()) 166 166 {} 167 167 -
src/Actions/unittests/ActionSequenceUnitTest.cpp
rd649b7 r126867 62 62 public: 63 63 canUndoActionStub(const ActionTrait &_trait): 64 Action(_trait ,NULL){}64 Action(_trait){} 65 65 virtual ~canUndoActionStub(){} 66 66 … … 91 91 public: 92 92 cannotUndoActionStub(const ActionTrait &_trait) : 93 Action(_trait ,NULL){}93 Action(_trait){} 94 94 virtual ~cannotUndoActionStub(){} 95 95 … … 120 120 public: 121 121 wasCalledActionStub(const ActionTrait &_trait) : 122 Action(_trait ,NULL),122 Action(_trait), 123 123 called(false) 124 124 {} … … 277 277 278 278 ActionTrait MakroTrait("Test MakroAction"); 279 MakroAction act(MakroTrait,*sequence ,NULL);279 MakroAction act(MakroTrait,*sequence); 280 280 281 281 act.call(); -
src/UIElements/Menu/TextMenu/TextMenu.hpp
rd649b7 r126867 155 155 token, 156 156 lastposition(token)+2); // have a separator in between 157 new TxMenu::LeaveAction(NewMenu->getMenuInstance(), leaveTrait); 157 MoleCuilder::Action *_action = new TxMenu::LeaveAction(NewMenu->getMenuInstance(), leaveTrait); 158 MoleCuilder::ActionQueue::getInstance().registerAction(_action); 158 159 NewMenu->init(); 159 160 new ActionMenuItem('q',"leave"+token,NewMenu->getMenuInstance(),"leave"+token); -
src/UIElements/Menu/TextMenu/TxMenuLeaveAction.cpp
rd649b7 r126867 48 48 */ 49 49 TxMenu::LeaveAction::LeaveAction(TxMenu* const _menu, const ActionTrait & LeaveActionTrait) : 50 Action(LeaveActionTrait , &ActionQueue::getInstance().getActionRegistry()),50 Action(LeaveActionTrait), 51 51 menu(_menu) 52 52 {} -
src/UIElements/TextUI/TextWindow.cpp
rd649b7 r126867 91 91 // create a specific quit action for this UI and store in registry 92 92 ActionTrait quitTrait(OptionTrait("quit", &typeid(void), "quits the program")); 93 quitAction = new MethodAction(quitTrait,boost::bind(&TxMenu::doQuit,main_menu->getMenuInstance()),&ActionQueue::getInstance().getActionRegistry()); 93 quitAction = new MethodAction(quitTrait,boost::bind(&TxMenu::doQuit,main_menu->getMenuInstance())); 94 MoleCuilder::ActionQueue::getInstance().registerAction(quitAction); 94 95 new ActionMenuItem('q',"quit",main_menu->getMenuInstance(),"quit"); 95 96 … … 100 101 TextWindow::~TextWindow() 101 102 { 102 for (std::list<Action *>::iterator iter = returnFromActions.begin();103 !returnFromActions.empty();104 iter = returnFromActions.begin()) {105 delete (*iter);106 returnFromActions.erase(iter);107 }108 103 delete moleculeView; 109 104 delete statusIndicator; -
src/UIElements/TextUI/TextWindow.hpp
rd649b7 r126867 41 41 TextMenu<TxMenu> *main_menu; 42 42 43 // some actions only needed in textMenus44 std::list<MoleCuilder::Action *> returnFromActions;45 43 MoleCuilder::Action *quitAction; 46 44 // all views that are contained in the main Menu -
src/World.cpp
rd649b7 r126867 373 373 ManipulateAtomsProcess* World::manipulateAtoms(boost::function<void(atom*)> op,std::string name,AtomDescriptor descr){ 374 374 ActionTrait manipulateTrait(name); 375 return new ManipulateAtomsProcess(op, descr,manipulateTrait ,NULL);375 return new ManipulateAtomsProcess(op, descr,manipulateTrait); 376 376 } 377 377
Note:
See TracChangeset
for help on using the changeset viewer.