frepple::utils::Command Class Reference

Abstract base class for all commands. More...

#include <utils.h>

Inheritance diagram for frepple::utils::Command:

List of all members.

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.

Definition at line 3836 of file utils.h.


Constructor & Destructor Documentation

frepple::utils::Command::Command ( ) [inline]

Default constructor. The creation of a command should NOT execute the command yet. The execute() method needs to be called explicitly to do so.

Definition at line 3846 of file utils.h.

virtual frepple::utils::Command::~Command ( ) [inline, virtual]

Destructor.

Definition at line 3883 of file utils.h.


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.

Definition at line 3854 of file utils.h.

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.

Definition at line 3880 of file utils.h.

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.

Definition at line 3862 of file utils.h.

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.

Definition at line 3872 of file utils.h.


Friends And Related Function Documentation

friend class CommandList [friend]

Definition at line 3838 of file utils.h.

friend class CommandManager [friend]

Reimplemented in frepple::utils::CommandManager::Bookmark.

Definition at line 3839 of file utils.h.

friend class frepple::CommandMoveOperationPlan [friend]

Definition at line 3840 of file utils.h.


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

Documentation generated for frePPLe by  doxygen