/* * SubgraphDissectionAction.hpp * * Created on: Mar 1, 2013 * Author: heber */ #ifndef SUBGRAPHDISSECTIONACTION_HPP_ #define SUBGRAPHDISSECTIONACTION_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "Actions/ActionSequence.hpp" #include "Actions/ActionTraits.hpp" #include "Actions/MakroAction.hpp" #include "SubgraphDissectionAction.def" // some derived names: if CATEGORY is not given, we don't prefix with it #ifdef CATEGORY #define ACTION BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Action)) #define COMMAND BOOST_PP_CAT(CATEGORY, ACTIONNAME) #define PARAMS BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Parameters)) #else #define ACTION BOOST_PP_CAT(ACTIONNAME, Action) #define COMMAND ACTIONNAME #define PARAMS BOOST_PP_CAT(ACTIONNAME, Parameters) #endif // check if no lists given #ifndef paramtypes #define MAXPARAMTYPES 0 #else #define MAXPARAMTYPES BOOST_PP_SEQ_SIZE(paramtypes) #endif #ifndef paramdefaults #define MAXPARAMDEFAULTS 0 #else #define MAXPARAMDEFAULTS BOOST_PP_SEQ_SIZE(paramdefaults) #endif namespace MoleCuilder { // print a list of type ref followed, i.e. "int i, double position" #define type_list(z,n,TYPELIST, VARLIST) \ BOOST_PP_COMMA_IF(n)\ BOOST_PP_SEQ_ELEM(n, TYPELIST) \ BOOST_PP_SEQ_ELEM(n, VARLIST) void COMMAND( #if defined paramtypes && defined paramreferences #define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, paramtypes, paramreferences) #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMTYPES-1) #include BOOST_PP_LOCAL_ITERATE() #endif ); class GraphSubgraphDissectionAction; template <> class ActionTraits : public ActionTrait { public: ActionTraits() : #ifndef SHORTFORM ActionTrait(OptionTrait(TOKEN, &typeid(void), DESCRIPTION, std::string())) #else ActionTrait(OptionTrait(TOKEN, &typeid(void), DESCRIPTION, std::string(), SHORTFORM)) #endif /* SHORTFORM */ { // initialize remainder of action info #ifdef MENUNAME MenuTitle = MENUNAME; #endif #ifdef MENUPOSITION MenuPosition = MENUPOSITION; #endif // we got no options to initialize } virtual ~ActionTraits() { //std::cout << "ActionTraits<" << BOOST_PP_STRINGIZE(ACTION) << ">::~ActionTraits() on instance " << this << " with name " << getName() << " called." << std::endl; } }; class GraphSubgraphDissectionAction : public MakroAction { public: GraphSubgraphDissectionAction(); virtual ~GraphSubgraphDissectionAction(); // must be called after all primitive actions are present void prepare(ActionRegistry &AR); // must be called before alle primitive actions are removed void unprepare(ActionRegistry &AR); virtual Action::state_ptr performCall(); virtual Action::state_ptr performUndo(Action::state_ptr); virtual Action::state_ptr performRedo(Action::state_ptr); private: //!> flag to check whether actions have been prepared static bool isPrepared; //!> sequence of actions for this macro action static ActionSequence actions; }; } #undef ACTION #undef COMMAND #undef COMMANDFULL #undef PARAMS #undef ACTIONNAME #undef CATEGORY #undef MENUNAME #undef MENUPOSITION #undef TOKEN #undef DESCRIPTION #undef SHORTFORM #endif /* SUBGRAPHDISSECTIONACTION_HPP_ */