#include <FXGenericTools.h>
Inheritance diagram for FX::Generic::DoUndo< obj, doaddr, undoaddr >:
This is a very useful class for generically calling some function on construction and then some other on destruction (and thus is exception-safe). Obviously it is intended for usage on the stack as an auto-scoped instance. During its lifetime you can temporarily undo() and redo() the action.
Note that there are two forms of DoUndo - fast and slow. The fast takes pointers to a function or member function which has no parameters and thus costs one virtual method call per invocation. The slow takes a FX::Generic::BoundFunctor and thus costs two virtual method calls per invocation. Obviously there are two invocations per scope.
For the fast, passing void
as the object type gets you a non-member function invocation. The default parameters of all the template parameters gives you the slow type. With those taking a bound functor (slow type), DoUndo takes ownership of the pointer you pass.
Definition at line 2343 of file FXGenericTools.h.
Public Member Functions | |
DoUndo (obj *_instance, doaddr _doa, undoaddr _undoa) | |
~DoUndo () | |
void | undo () |
void | redo () |