Stack of undoable modifications. More...
#include <UndoManager.hh>

Public Member Functions | |
| virtual | ~UndoManager () |
| Destructor. | |
| UndoState | save () |
| Save current state. | |
| void | record (UndoBase *event) |
| Record a modification for later rewinding. | |
Protected Member Functions | |
| void | restore (unsigned pos) |
| Undo events in reverse order up to a certain state. | |
Private Attributes | |
| std::vector< UndoBase * > | events |
| A stack of undoable events. | |
Friends | |
| void | UndoState::restore () |
| The UndoState may initiate rewinding of modifications. | |
Stack of undoable modifications.
Whenever a class performs some local modification that needs to be unwound when the current branch is left, this modification can be registered with the UndoManager. In this way, no class has to care for properly cleaning up all modifications in all possible cases. It registers the undo event when it performs the modification in the first place, and after that it can forget about it. The branching code will ask the undo manager to rewind modifications in reverse order at appropriate times.
Definition at line 117 of file UndoManager.hh.
| bande::UndoManager::~UndoManager | ( | ) | [virtual] |
Destructor.
Cleans up all undo events stored in the stack, without undoing them.
Definition at line 38 of file UndoManager.cc.
References events.
| void bande::UndoManager::record | ( | UndoBase * | event | ) | [inline] |
Record a modification for later rewinding.
The undo manager will ensure the objects will get deleted eventually.
| event | an undoable object describing the modification. |
Definition at line 140 of file UndoManager.hh.
References events.
Referenced by bande::LinearProgram::setColLower(), bande::IntegerProgram::setColLower(), bande::LinearProgram::setColUpper(), and bande::IntegerProgram::setColUpper().
| void bande::UndoManager::restore | ( | unsigned | pos | ) | [protected] |
Undo events in reverse order up to a certain state.
This is a protected method to be accessed by UndoState.
| pos | the stack position to which to rewind. |
Definition at line 52 of file UndoManager.cc.
References events.
Referenced by bande::UndoState::restore().
| UndoState bande::UndoManager::save | ( | ) | [inline] |
Save current state.
The returned object can be used to rewind all modifications added after its creation.
Definition at line 131 of file UndoManager.hh.
References events.
Referenced by bande::BranchControl::branch().
1.6.0