Changeset 26b4eb4 for src/Actions


Ignore:
Timestamp:
Jun 27, 2014, 9:32:02 PM (11 years ago)
Author:
Frederik Heber <heber@…>
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:
378f2d5
Parents:
3ded2b7
git-author:
Frederik Heber <heber@…> (06/19/14 09:17:06)
git-committer:
Frederik Heber <heber@…> (06/27/14 21:32:02)
Message:

Added observable ActionStatusList to ActionQueue.

  • this allows to fetch Status messages from Actions at a central place.
  • Action::pushStatus() as befriended proxy to ActionQueue::pushStatus() added.
  • equipped ActionStatusList with a thread lock to protect access.
Location:
src/Actions
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/Action.cpp

    r3ded2b7 r26b4eb4  
    177177}
    178178
     179void Action::pushStatus(const std::string& _msg)
     180{
     181  ActionQueue::getInstance().pushStatus(_msg);
     182}
     183
  • src/Actions/Action.hpp

    r3ded2b7 r26b4eb4  
    2424 */
    2525#define NOPARAM_DEFAULT BOOST_PP_NIL
     26
     27/** Nicely visible short-hand for push a status message
     28 *
     29 */
     30#ifndef STATUS
     31#define STATUS(msg) pushStatus(msg)
     32#endif
    2633
    2734// forward declaration
     
    270277  static void insertAction(Action *_action, enum Action::QueryOptions state);
    271278
     279  /** Proxy function to grant all derived Actions access to
     280   * ActionQueue::pushStatus().
     281   *
     282   * \param _msg status message to push
     283   */
     284  void pushStatus(const std::string& _msg);
     285
    272286private:
    273287
  • src/Actions/ActionQueue.hpp

    r3ded2b7 r26b4eb4  
    2424#include "Actions/Action.hpp"
    2525#include "Actions/ActionState.hpp"
     26#include "Actions/ActionStatusList.hpp"
    2627
    2728#ifdef HAVE_ACTION_THREAD
     
    127128#endif
    128129
     130  /** Getter to ref to list of status messages.
     131   *
     132   * This is meant for UIs to registers as Observables.
     133   *
     134   * \return ref to StatusList variable
     135   */
     136  ActionStatusList& getStatusList()
     137  { return StatusList; }
     138
    129139private:
    130140  //!> grant Action access to internal history functions.
     
    138148  void addElement(Action* _Action, ActionState::ptr _state);
    139149
     150  /** Advocate function to add status message to the list.
     151   *
     152   */
     153  void pushStatus(const std::string &_msg)
     154  { StatusList.pushMessage(_msg); }
     155
    140156  /** Wrapper function to clear ActionHistory.
    141157   *
     
    221237  boost::mutex mtx_idle;
    222238#endif
     239
     240  //!> internal list of status messages from Actions for UIs to display
     241  ActionStatusList StatusList;
    223242};
    224243
  • src/Actions/Makefile.am

    r3ded2b7 r26b4eb4  
    88  Actions/ActionRegistry.cpp \
    99  Actions/ActionSequence.cpp \
     10  Actions/ActionStatusList.cpp \
    1011  Actions/ActionTrait.cpp \
    1112  Actions/ErrorAction.cpp \
     
    3334  Actions/ActionSequence.hpp \
    3435  Actions/ActionState.hpp \
     36  Actions/ActionStatusList.hpp \
    3537  Actions/ActionTrait.hpp \
    3638  Actions/ActionTraits.hpp \
Note: See TracChangeset for help on using the changeset viewer.