/* * MethodAction.hpp * * Created on: Dec 11, 2009 * Author: crueger */ #ifndef METHODACTION_HPP_ #define METHODACTION_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Actions/Action.hpp" namespace MoleCuilder { class ActionRegistry; /** * Wrapper class that allows the construction of Actions from any kind of Method */ class MethodAction : public Action { public: MethodAction(const ActionTrait &_trait,boost::function _executeMethod); virtual ~MethodAction(); virtual bool canUndo(); virtual bool shouldUndo(); virtual Action* clone(enum QueryOptions flag = Interactive) const; void outputAsCLI(std::ostream &ost) const; void outputAsPython(std::ostream &ost, const std::string &prefix) const; void setOptionValue(const std::string &_token, const std::string &_value); protected: virtual Dialog * fillDialog(Dialog *dialog); private: virtual ActionState::ptr performCall(); virtual ActionState::ptr performUndo(ActionState::ptr); virtual ActionState::ptr performRedo(ActionState::ptr); boost::function executeMethod; //!< this stores the method to be called }; } #endif /* METHODACTION_HPP_ */