Ignore:
Timestamp:
Aug 26, 2010, 9:13:11 PM (15 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:
9ee38b
Parents:
9c1c89
git-author:
Frederik Heber <heber@…> (08/25/10 13:22:58)
git-committer:
Frederik Heber <heber@…> (08/26/10 21:13:11)
Message:

Implemented macros for automatically generating repetitive stuff around Actions.

The idea is that only the following items have to be provided for by the user

  • parameters (i.e. for each the following tupel: type, token and reference)
  • perform...(), ...Undo(), ...

Therefore, we have three new files:

  • Action_impl_header.hpp: Is for the declarations in the header
  • Action_impl_pre.hpp: Is before definition of functions
  • Action_impl_post.hpp: is after definition of functions (cleanup)

Changes:

Location:
src/Actions/AnalysisAction
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/AnalysisAction/MolecularVolumeAction.cpp

    r9c1c89 r0b2ce9  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/AnalysisAction/MolecularVolumeAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "boundary.hpp"
    2523#include "config.hpp"
     
    3634using namespace std;
    3735
    38 #include "UIElements/UIFactory.hpp"
    39 #include "UIElements/Dialog.hpp"
    40 #include "Actions/ValueStorage.hpp"
     36#include "Actions/AnalysisAction/MolecularVolumeAction.hpp"
    4137
    42 const char AnalysisMolecularVolumeAction::NAME[] = "molecular-volume";
     38// and construct the stuff
     39#include "Action_impl_pre.hpp"
    4340
    44 AnalysisMolecularVolumeAction::AnalysisMolecularVolumeAction() :
    45   Action(NAME)
    46 {}
    47 
    48 AnalysisMolecularVolumeAction::~AnalysisMolecularVolumeAction()
    49 {}
    50 
    51 void AnalysisMolecularVolume() {
    52   ActionRegistry::getInstance().getActionByName(AnalysisMolecularVolumeAction::NAME)->call(Action::NonInteractive);
    53 };
    54 
    55 Dialog * AnalysisMolecularVolumeAction::fillDialog(Dialog *dialog) {
    56   ASSERT(dialog,"No Dialog given when filling action dialog");
    57   dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
    58 
    59   return dialog;
    60 }
    61 
    62 Action::state_ptr AnalysisMolecularVolumeAction::performCall() {
    63   int molID = -1;
     41/** =========== define the function ====================== */
     42Action::state_ptr ACTION::performCall() {
    6443  // obtain information
    65   ValueStorage::getInstance().queryCurrentValue(NAME, molID);
     44  getParametersfromValueStorage();
    6645
    6746  // execute action
     
    8766}
    8867
    89 Action::state_ptr AnalysisMolecularVolumeAction::performUndo(Action::state_ptr _state) {
     68Action::state_ptr ACTION::performUndo(Action::state_ptr _state) {
    9069  return Action::success;
    9170}
    9271
    93 Action::state_ptr AnalysisMolecularVolumeAction::performRedo(Action::state_ptr _state){
     72Action::state_ptr ACTION::performRedo(Action::state_ptr _state){
    9473  return Action::success;
    9574}
    9675
    97 bool AnalysisMolecularVolumeAction::canUndo() {
     76bool ACTION::canUndo() {
    9877  return true;
    9978}
    10079
    101 bool AnalysisMolecularVolumeAction::shouldUndo() {
     80bool ACTION::shouldUndo() {
    10281  return true;
    10382}
    10483
    105 const string AnalysisMolecularVolumeAction::getName() {
     84const string ACTION::getName() {
    10685  return NAME;
    10786}
     87/** =========== end of function ====================== */
     88
     89// and clean the stuff
     90#include "Action_impl_post.hpp"
  • src/Actions/AnalysisAction/MolecularVolumeAction.hpp

    r9c1c89 r0b2ce9  
    1616#include "Actions/Action.hpp"
    1717
    18 void AnalysisMolecularVolume();
     18// i.e. there is an integer with variable name Z that can be found in
     19// ValueStorage by the token "Z" -> first column: int, Z, "Z"
     20// "undefine" if no parameters are required
     21//#define types (int)
     22//#define references (molID)
     23//#define tokens (NAME)
     24// some defines for all the names, you may use ACTION, STATE and PARAMS
     25#define CATEGORY Analysis
     26#define ACTIONNAME MolecularVolume
     27#define TOKEN "molecular-volume"
    1928
    20 class AnalysisMolecularVolumeAction : public Action {
    21   friend void AnalysisMolecularVolume();
    22 public:
    23   AnalysisMolecularVolumeAction();
    24   virtual ~AnalysisMolecularVolumeAction();
    25 
    26   bool canUndo();
    27   bool shouldUndo();
    28 
    29   virtual const std::string getName();
    30 
    31 protected:
    32   virtual Dialog * fillDialog(Dialog*);
    33 private:
    34   virtual Action::state_ptr performCall();
    35   virtual Action::state_ptr performUndo(Action::state_ptr);
    36   virtual Action::state_ptr performRedo(Action::state_ptr);
    37 
    38   static const char NAME[];
    39 };
     29#include "Action_impl_header.hpp"
    4030
    4131#endif /* MOLECULARVOLUMEACTION_HPP_ */
  • src/Actions/AnalysisAction/PairCorrelationAction.cpp

    r9c1c89 r0b2ce9  
    6262};
    6363
     64
     65void AnalysisPairCorrelationAction::getParametersfromValueStorage()
     66{};
    6467
    6568Dialog* AnalysisPairCorrelationAction::fillDialog(Dialog* dialog) {
  • src/Actions/AnalysisAction/PairCorrelationAction.hpp

    r9c1c89 r0b2ce9  
    3535  virtual Dialog * fillDialog(Dialog*);
    3636private:
    37    virtual Action::state_ptr performCall();
     37   virtual void getParametersfromValueStorage();
     38  virtual Action::state_ptr performCall();
    3839  virtual Action::state_ptr performUndo(Action::state_ptr);
    3940  virtual Action::state_ptr performRedo(Action::state_ptr);
  • src/Actions/AnalysisAction/PointCorrelationAction.cpp

    r9c1c89 r0b2ce9  
    6363  ActionRegistry::getInstance().getActionByName(AnalysisPointCorrelationAction::NAME)->call(Action::NonInteractive);
    6464};
     65
     66void AnalysisPointCorrelationAction::getParametersfromValueStorage()
     67{};
    6568
    6669Dialog* AnalysisPointCorrelationAction::fillDialog(Dialog *dialog) {
  • src/Actions/AnalysisAction/PointCorrelationAction.hpp

    r9c1c89 r0b2ce9  
    3737  virtual Dialog * fillDialog(Dialog*);
    3838private:
     39  virtual void getParametersfromValueStorage();
    3940  virtual Action::state_ptr performCall();
    4041  virtual Action::state_ptr performUndo(Action::state_ptr);
  • src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp

    r9c1c89 r0b2ce9  
    5050  ActionRegistry::getInstance().getActionByName(AnalysisPrincipalAxisSystemAction::NAME)->call(Action::NonInteractive);
    5151};
     52
     53void AnalysisPrincipalAxisSystemAction::getParametersfromValueStorage()
     54{};
    5255
    5356Dialog* AnalysisPrincipalAxisSystemAction::fillDialog(Dialog *dialog) {
  • src/Actions/AnalysisAction/PrincipalAxisSystemAction.hpp

    r9c1c89 r0b2ce9  
    2727  virtual Dialog * fillDialog(Dialog *);
    2828private:
     29  virtual void getParametersfromValueStorage();
    2930  virtual Action::state_ptr performCall();
    3031  virtual Action::state_ptr performUndo(Action::state_ptr);
  • src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp

    r9c1c89 r0b2ce9  
    6464};
    6565
     66
     67void AnalysisSurfaceCorrelationAction::getParametersfromValueStorage()
     68{};
    6669
    6770Dialog* AnalysisSurfaceCorrelationAction::fillDialog(Dialog *dialog) {
  • src/Actions/AnalysisAction/SurfaceCorrelationAction.hpp

    r9c1c89 r0b2ce9  
    3131  virtual Dialog * fillDialog(Dialog*);
    3232private:
     33  virtual void getParametersfromValueStorage();
    3334  virtual Action::state_ptr performCall();
    3435  virtual Action::state_ptr performUndo(Action::state_ptr);
Note: See TracChangeset for help on using the changeset viewer.