| 1 | /*
|
|---|
| 2 | * Action_impl.hpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Aug 25, 2010
|
|---|
| 5 | * Author: heber
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | /** These macros define the following functions, necessary but repetitive for
|
|---|
| 9 | * every Action:
|
|---|
| 10 | * -# Dialog* fillDialog()
|
|---|
| 11 | * -# action command (e.g. AnalysisMolecularVolume() )
|
|---|
| 12 | * -# void getParametersfromValuStorage()
|
|---|
| 13 | * -# struct Action...Parameters
|
|---|
| 14 | *
|
|---|
| 15 | * For this, the user has the define the following values, each with
|
|---|
| 16 | * parenthesis:
|
|---|
| 17 | * -# types, e.g. (int)(double)
|
|---|
| 18 | * -# tokens, e.g. ("Z")("length")
|
|---|
| 19 | * -# references, e.g. (Z)(length)
|
|---|
| 20 | * and
|
|---|
| 21 | * -# CATEGORY, e.g. Analysis
|
|---|
| 22 | * -# ACTIONNAME, e.g. MolecularVolume
|
|---|
| 23 | */
|
|---|
| 24 |
|
|---|
| 25 | #include "Actions/ActionRegistry.hpp"
|
|---|
| 26 | #include "UIElements/Dialog.hpp"
|
|---|
| 27 | #include "Actions/ValueStorage.hpp"
|
|---|
| 28 |
|
|---|
| 29 | const char ACTION::NAME[] = TOKEN;
|
|---|
| 30 |
|
|---|
| 31 | // the actual functions constructed
|
|---|
| 32 |
|
|---|
| 33 | ACTION::ACTION () :
|
|---|
| 34 | Action(NAME)
|
|---|
| 35 | {}
|
|---|
| 36 |
|
|---|
| 37 | ACTION::~ACTION ()
|
|---|
| 38 | {}
|
|---|
| 39 |
|
|---|
| 40 | Dialog* ACTION::fillDialog(Dialog *dialog) {
|
|---|
| 41 | ASSERT(dialog,"No Dialog given when filling actionname's dialog");
|
|---|
| 42 | #if BOOST_PP_EQUAL(MAXNOTOKENS,0)
|
|---|
| 43 | dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
|
|---|
| 44 | #else
|
|---|
| 45 | #define BOOST_PP_LOCAL_MACRO(n) dialog_print(~, n, ~)
|
|---|
| 46 | #define BOOST_PP_LOCAL_LIMITS (0, MAXNOTOKENS-1)
|
|---|
| 47 | #include BOOST_PP_LOCAL_ITERATE()
|
|---|
| 48 | #undef BOOST_PP_LOCAL_MACRO
|
|---|
| 49 | #undef BOOST_PP_LOCAL_LIMITS
|
|---|
| 50 | #endif
|
|---|
| 51 | return dialog;
|
|---|
| 52 | };
|
|---|
| 53 |
|
|---|
| 54 | struct PARAMS : ActionParameters {
|
|---|
| 55 | #if BOOST_PP_NOT_EQUAL(MAXNOTOKENS,0)
|
|---|
| 56 | #define BOOST_PP_LOCAL_MACRO(n) type_print(~, n, ;)
|
|---|
| 57 | #define BOOST_PP_LOCAL_LIMITS (0, MAXNOTOKENS-1)
|
|---|
| 58 | #include BOOST_PP_LOCAL_ITERATE()
|
|---|
| 59 | #undef BOOST_PP_LOCAL_MACRO
|
|---|
| 60 | #undef BOOST_PP_LOCAL_LIMITS
|
|---|
| 61 | #endif
|
|---|
| 62 | };
|
|---|
| 63 |
|
|---|
| 64 | COMMANDFULL
|
|---|
| 65 | {
|
|---|
| 66 | #if BOOST_PP_NOT_EQUAL(MAXNOTOKENS,0)
|
|---|
| 67 | #define BOOST_PP_LOCAL_MACRO(n) value_print(~, n, setCurrentValue)
|
|---|
| 68 | #define BOOST_PP_LOCAL_LIMITS (0, MAXNOTOKENS-1)
|
|---|
| 69 | #include BOOST_PP_LOCAL_ITERATE()
|
|---|
| 70 | #undef BOOST_PP_LOCAL_MACRO
|
|---|
| 71 | #undef BOOST_PP_LOCAL_LIMITS
|
|---|
| 72 | #endif
|
|---|
| 73 | ActionRegistry::getInstance().getActionByName( ACTION::NAME )->call(Action::NonInteractive);
|
|---|
| 74 | };
|
|---|
| 75 |
|
|---|
| 76 | void AnalysisMolecularVolumeAction::getParametersfromValueStorage() {
|
|---|
| 77 | #if BOOST_PP_NOT_EQUAL(MAXNOTOKENS,0)
|
|---|
| 78 | #define BOOST_PP_LOCAL_MACRO(n) value_print(~, n, queryCurrentValue)
|
|---|
| 79 | #define BOOST_PP_LOCAL_LIMITS (0, MAXNOTOKENS-1)
|
|---|
| 80 | #include BOOST_PP_LOCAL_ITERATE()
|
|---|
| 81 | #undef BOOST_PP_LOCAL_MACRO
|
|---|
| 82 | #undef BOOST_PP_LOCAL_LIMITS
|
|---|
| 83 | #endif
|
|---|
| 84 | };
|
|---|
| 85 |
|
|---|
| 86 | #undef types
|
|---|
| 87 | #undef tokens
|
|---|
| 88 | #undef references
|
|---|
| 89 | #undef MAXNOTOKENS
|
|---|
| 90 |
|
|---|