/* * ActionSequence.hpp * * Created on: Dec 17, 2009 * Author: crueger */ #ifndef ACTIONSEQUENZE_HPP_ #define ACTIONSEQUENZE_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "Actions/Action.hpp" #include class ActionSequenceTest; namespace MoleCuilder { /** * Store Actions for later use. */ class ActionSequence { friend class MakroAction; //!> grant unit test access to private sequence friend class ::ActionSequenceTest; public: typedef std::deque actionSet; typedef std::deque stateSet; ActionSequence(); ActionSequence(const ActionSequence &_other); virtual ~ActionSequence(); void addAction(Action*); Action* removeLastAction(); unsigned int getLoop() const { return loop; } void callAll(); bool canUndo(); bool shouldUndo(); 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: /** removes the first occurence of an action name \a name from sequence. * * \param name name of action * \return true - action removed, false - action not found */ bool removeAction(const std::string &name); stateSet callAll(bool); // Dummy parameter to allow overloading Dialog* fillAllDialogs(Dialog *dialog); stateSet undoAll(stateSet); stateSet redoAll(stateSet); void setLoop(unsigned int _loop) { loop = _loop; } unsigned int getStep() const { return step; } private: actionSet actions; //!> how often the sequence is repeated unsigned int loop; //!> current step (used in loops) unsigned int step; }; } #endif /* ACTIONSEQUENZE_HPP_ */