source: src/Actions/GraphAction/SubgraphDissectionAction.hpp@ 6367dd

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
Last change on this file since 6367dd was b5b01e, checked in by Frederik Heber <heber@…>, 12 years ago

ActionState extracted into own header file, rename Action::state_ptr -> ActionState::ptr.

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[97ebf8]1/*
2 * SubgraphDissectionAction.hpp
3 *
[22b786]4 * Created on: Mar 1, 2013
[97ebf8]5 * Author: heber
6 */
7
8#ifndef SUBGRAPHDISSECTIONACTION_HPP_
[c4b85d]9#define SUBGRAPHDISSECTIONACTION_HPP_
[97ebf8]10
[56f73b]11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
[22b786]16#include "Actions/ActionSequence.hpp"
17#include "Actions/ActionTraits.hpp"
18#include "Actions/MakroAction.hpp"
[97ebf8]19
[1fd675]20#include "SubgraphDissectionAction.def"
[22b786]21
22// some derived names: if CATEGORY is not given, we don't prefix with it
23#ifdef CATEGORY
24#define ACTION BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Action))
25#define COMMAND BOOST_PP_CAT(CATEGORY, ACTIONNAME)
26#define PARAMS BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Parameters))
27#else
28#define ACTION BOOST_PP_CAT(ACTIONNAME, Action)
29#define COMMAND ACTIONNAME
30#define PARAMS BOOST_PP_CAT(ACTIONNAME, Parameters)
31#endif
32// check if no lists given
33#ifndef paramtypes
34#define MAXPARAMTYPES 0
35#else
36#define MAXPARAMTYPES BOOST_PP_SEQ_SIZE(paramtypes)
37#endif
38#ifndef paramdefaults
39#define MAXPARAMDEFAULTS 0
40#else
41#define MAXPARAMDEFAULTS BOOST_PP_SEQ_SIZE(paramdefaults)
42#endif
43
44namespace MoleCuilder {
45
46// print a list of type ref followed, i.e. "int i, double position"
47#define type_list(z,n,TYPELIST, VARLIST) \
48 BOOST_PP_COMMA_IF(n)\
49 BOOST_PP_SEQ_ELEM(n, TYPELIST) \
50 BOOST_PP_SEQ_ELEM(n, VARLIST)
51
52void COMMAND(
53#if defined paramtypes && defined paramreferences
54#define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, paramtypes, paramreferences)
55#define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMTYPES-1)
56#include BOOST_PP_LOCAL_ITERATE()
57#endif
58 );
59
60class GraphSubgraphDissectionAction;
61
62template <>
63class ActionTraits<ACTION> : public ActionTrait {
64public:
65 ActionTraits() :
66#ifndef SHORTFORM
67 ActionTrait(OptionTrait(TOKEN, &typeid(void), DESCRIPTION, std::string()))
68#else
69 ActionTrait(OptionTrait(TOKEN, &typeid(void), DESCRIPTION, std::string(), SHORTFORM))
70#endif /* SHORTFORM */
71 {
72 // initialize remainder of action info
73#ifdef MENUNAME
74 MenuTitle = MENUNAME;
75#endif
76#ifdef MENUPOSITION
77 MenuPosition = MENUPOSITION;
78#endif
79
80 // we got no options to initialize
81 }
82
83 virtual ~ActionTraits() {
84 //std::cout << "ActionTraits<" << BOOST_PP_STRINGIZE(ACTION) << ">::~ActionTraits() on instance " << this << " with name " << getName() << " called." << std::endl;
85 }
86};
87
88class GraphSubgraphDissectionAction : public MakroAction
89{
90public:
91 GraphSubgraphDissectionAction();
92 virtual ~GraphSubgraphDissectionAction();
93
94 // must be called after all primitive actions are present
95 void prepare(ActionRegistry &AR);
96 // must be called before alle primitive actions are removed
97 void unprepare(ActionRegistry &AR);
98
[b5b01e]99 virtual ActionState::ptr performCall();
100 virtual ActionState::ptr performUndo(ActionState::ptr);
101 virtual ActionState::ptr performRedo(ActionState::ptr);
[22b786]102
103private:
104 //!> flag to check whether actions have been prepared
105 static bool isPrepared;
106 //!> sequence of actions for this macro action
107 static ActionSequence actions;
108};
109
110}
111
112#undef ACTION
113#undef COMMAND
114#undef COMMANDFULL
115#undef PARAMS
116
117#undef ACTIONNAME
118#undef CATEGORY
119#undef MENUNAME
120#undef MENUPOSITION
121#undef TOKEN
122
123#undef DESCRIPTION
124#undef SHORTFORM
[97ebf8]125
126#endif /* SUBGRAPHDISSECTIONACTION_HPP_ */
Note: See TracBrowser for help on using the repository browser.