bande::UndoManager Class Reference

Stack of undoable modifications. More...

#include <UndoManager.hh>

Collaboration diagram for bande::UndoManager:
Collaboration graph

List of all members.

Public Member Functions

virtual ~UndoManager ()
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.


void UndoState::restore ()
 The UndoState may initiate rewinding of modifications.

Detailed Description

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.

Constructor & Destructor Documentation

bande::UndoManager::~UndoManager (  )  [virtual]


Cleans up all undo events stored in the stack, without undoing them.

Definition at line 38 of file

References events.

Member Function Documentation

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

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.

an object encapsulating the current state of the stack of modifications.

Definition at line 131 of file UndoManager.hh.

References events.

Referenced by bande::BranchControl::branch().

The documentation for this class was generated from the following files:

Generated on Fri Aug 21 08:17:19 2009 for bande by  doxygen 1.6.0