31 m_stack.push_back(tissue);
32 m_current = m_stack.begin();
37 assert(m_stack.size() > 0 &&
"The undo stack isn't initialized.");
38 m_stack.erase(
std::next(m_current), m_stack.end());
39 m_stack.push_back(tissue);
41 while (m_stack.size() > m_max_tissues) {
49 assert(m_stack.size() > 0 &&
"The undo stack isn't initialized.");
50 return (m_current != m_stack.begin());
54 assert(m_stack.size() > 0 &&
"The undo stack isn't initialized.");
55 return (
std::next(m_current) != m_stack.end());
60 assert(m_stack.size() > 0 &&
"The undo stack isn't initialized.");
69 assert(m_stack.size() > 0 &&
"The undo stack isn't initialized.");
const boost::property_tree::ptree & Redo()
Redo an action.
Namespace for SimPT tissue editor package.
void Push(const boost::property_tree::ptree &tissue)
Push a tissue to the stack.
void Initialize(const boost::property_tree::ptree &tissue)
Initialize the undo stack with a given tissue.
const boost::property_tree::ptree & Undo()
Undo an action.
virtual ~UndoStack()
Destructor.
bool CanUndo() const
True if the current action can be undone.
CircularIterator< T > next(CircularIterator< T > i)
Helper yields the position the iterator would have if moved forward (in circular fashion) by 1 positi...
bool CanRedo() const
True if the current action can be redone.
CircularIterator< T > prev(CircularIterator< T > i)
Helper yields the position the iterator would have if moved backward (in circular fashion) by 1 posit...