Changeset 29b52b
- Timestamp:
- Sep 12, 2014, 8:00:16 AM (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, 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:
- 8859b5
- Parents:
- 9bdcc9
- Location:
- src/Actions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/ActionQueue.cpp
r9bdcc9 r29b52b 55 55 using namespace MoleCuilder; 56 56 57 const Action* ActionQueue::_lastchangedaction = NULL; 58 57 59 ActionQueue::ActionQueue() : 60 Observable("ActionQueue"), 58 61 AR(new ActionRegistry()), 59 62 history(new ActionHistory), … … 66 69 run_thread_isIdle(true) 67 70 #endif 68 {} 71 { 72 // channels of observable 73 Channels *OurChannel = new Channels; 74 NotificationChannels.insert( std::make_pair(static_cast<Observable *>(this), OurChannel) ); 75 // add instance for each notification type 76 for (size_t type = 0; type < NotificationType_MAX; ++type) 77 OurChannel->addChannel(type); 78 } 69 79 70 80 ActionQueue::~ActionQueue() … … 91 101 void ActionQueue::queueAction(Action *_action, enum Action::QueryOptions state) 92 102 { 103 OBSERVE; 104 NOTIFY(ActionQueued); 93 105 Action *newaction = _action->clone(state); 94 106 newaction->prepare(state); … … 116 128 mtx_queue.unlock(); 117 129 #endif 130 _lastchangedaction = newaction; 118 131 } 119 132 -
src/Actions/ActionQueue.hpp
r9bdcc9 r29b52b 16 16 #include "CodePatterns/Singleton.hpp" 17 17 18 #include "CodePatterns/Observer/Channels.hpp" 19 #include "CodePatterns/Observer/Observable.hpp" 18 20 19 21 #ifdef HAVE_ACTION_THREAD … … 36 38 class ActionRegistry; 37 39 class ActionTrait; 40 41 namespace Queuedetail { 42 template <class T> const T* lastChanged() 43 { 44 ASSERT(0, "Queuedetail::lastChanged() - only specializations may be used."); 45 return NULL; 46 } 47 } 38 48 39 49 /** This class combines the whole handling of Actions into a single class. … … 42 52 * automatically queued and placed into a History after execution. 43 53 */ 44 class ActionQueue : public Singleton<ActionQueue> 54 class ActionQueue : public Singleton<ActionQueue>, public Observable 45 55 { 46 56 friend class Singleton<ActionQueue>; … … 49 59 typedef std::vector< Action * > ActionQueue_t; 50 60 61 //!> channels for this observable 62 enum NotificationType { 63 ActionQueued, // new action was queued 64 NotificationType_MAX // denotes the maximum of available notification types 65 }; 66 67 //>! access to last changed element (atom or molecule) 68 template <class T> const T* lastChanged() const 69 { return Queuedetail::lastChanged<T>(); } 70 51 71 /** Queues the Action with \a name to be called. 52 72 * … … 213 233 ~ActionQueue(); 214 234 235 private: 236 friend const Action *Queuedetail::lastChanged<Action>(); 237 static const Action *_lastchangedaction; 238 215 239 //!> ActionRegistry to spawn new actions 216 240 ActionRegistry *AR;
Note:
See TracChangeset
for help on using the changeset viewer.