Abstract base class for all commands. More...
#include <utils.h>

Public Member Functions | |
Command () | |
virtual void | commit () |
virtual void | redo () |
virtual void | rollback () |
virtual void | undo () |
virtual | ~Command () |
Friends | |
class | CommandList |
class | CommandManager |
class | frepple::CommandMoveOperationPlan |
Detailed Description
Abstract base class for all commands.
Command objects are designed for algorithms that need to keep track of their decision, efficiently undo them and redo them.
The key methods are:
- The constructor or other methods on the concrete subclasses implement the state change.
- commit(): Makes the change permanently. Undoing the change is no longer possible after calling this method.
- rollback(): Reverts the change permanently. Redoing the change is no longer possible after calling this method.
- undo(): Temporarily reverts the change. Redoing the change is still possible.
- redo(): Reactivates the change that was previously undone.
Constructor & Destructor Documentation
frepple::utils::Command::Command | ( | ) | [inline] |
virtual frepple::utils::Command::~Command | ( | ) | [inline, virtual] |
Member Function Documentation
virtual void frepple::utils::Command::commit | ( | ) | [inline, virtual] |
This method makes the change permanent.
A couple of notes on how this method should be implemented by the subclasses:
- Calling the method multiple times is harmless. Only the first call is expected to do something.
Reimplemented in frepple::CommandMoveOperationPlan, frepple::CommandDeleteOperationPlan, frepple::CommandCreateOperationPlan, frepple::utils::CommandList, and module_webservice::CommandWebservice.
virtual void frepple::utils::Command::redo | ( | ) | [inline, virtual] |
This method reproduces a previously undone change.
A couple of notes on how this method should be implemented by the subclasses:
- Calling the method multiple times is harmless and results in the same state change as calling it only once.
Reimplemented in frepple::CommandMoveOperationPlan, frepple::CommandDeleteOperationPlan, frepple::CommandCreateOperationPlan, and frepple::utils::CommandList.
virtual void frepple::utils::Command::rollback | ( | ) | [inline, virtual] |
This method permanently undoes the change.
A couple of notes on how this method should be implemented by the subclasses:
- Calling the rollback() method multiple times is harmless. Only the first call is expected to do something.
Reimplemented in frepple::CommandMoveOperationPlan, frepple::CommandDeleteOperationPlan, frepple::CommandCreateOperationPlan, and frepple::utils::CommandList.
virtual void frepple::utils::Command::undo | ( | ) | [inline, virtual] |
This method temporarily undoes the change. The concrete subclasses most maintain information that enables redoing the changes efficiently.
A couple of notes on how this method should be implemented by the subclasses:
- Calling the method multiple times is harmless and results in the same state change as calling it only once.
Reimplemented in frepple::CommandMoveOperationPlan, frepple::CommandDeleteOperationPlan, frepple::CommandCreateOperationPlan, and frepple::utils::CommandList.
Friends And Related Function Documentation
friend class CommandList [friend] |
friend class CommandManager [friend] |
Reimplemented in frepple::utils::CommandManager::Bookmark.
friend class frepple::CommandMoveOperationPlan [friend] |
The documentation for this class was generated from the following file:
Documentation generated for frePPLe by
