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