/* * ActionHistory.hpp * * Created on: Mar 25, 2010 * Author: crueger */ #ifndef ACTIONHISTORY_HPP_ #define ACTIONHISTORY_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include "Actions/Action.hpp" #include "Actions/RedoAction.hpp" #include "Actions/UndoAction.hpp" namespace MoleCuilder { class ActionHistory { struct HistoryElement { HistoryElement(Action *_action, ActionState::ptr _state) : action(_action), state(_state) {} Action *action; ActionState::ptr state; }; public: ActionHistory(); ~ActionHistory(); void undoLast(); void redoLast(); bool hasUndo(); bool hasRedo(); void addElement(Action*,ActionState::ptr); void clear(); private: std::deque history; std::deque yrotsih; public: // when constructing the actions we need the Actionregistry Singleton // Singletons need static variables to work, but we cannot access statics // inside a static initialization, so we have this init function that // needs to be called at a non-static point at the start of the program // static void init(); }; } #endif /* ACTIONHISTORY_HPP_ */