A container command to group a series of commands together. More...
#include <utils.h>
Public Member Functions | |
| void | add (Command *c) |
| CommandList () | |
| bool | empty () const |
| void | execute () |
| bool | getAbortOnError () const |
| string | getDescription () const |
| Command * | getLastCommand () const |
| int | getMaxParallel () const |
| int | getNumberOfCommands () const |
| void | setAbortOnError (bool b) |
| void | setMaxParallel (int b) |
| void | undo (Command *c) |
| void | undo () |
| bool | undoable (const Command *c) const |
| bool | undoable () const |
| virtual | ~CommandList () |
A container command to group a series of commands together.
This class implements the "composite" design pattern in order to get an efficient and intuitive hierarchical grouping of tasks.
A command list can be executed in three different modes:
Definition at line 3107 of file utils.h.
| frepple::utils::CommandList::CommandList | ( | ) | [inline, explicit] |
| frepple::utils::CommandList::~CommandList | ( | ) | [virtual] |
Destructor.
A commandlist should only be deleted when all of its commands have been committed or undone. If this is not the case a warning will be printed.
Definition at line 370 of file utils/actions.cpp.
| void frepple::utils::CommandList::add | ( | Command * | c | ) |
Append an additional command to the end of the list.
Definition at line 76 of file utils/actions.cpp.
| bool frepple::utils::CommandList::empty | ( | ) | const [inline] |
| void frepple::utils::CommandList::execute | ( | ) | [virtual] |
Commits all actions on its list. At the end it also clear the list of actions.
Implements frepple::utils::Command.
Reimplemented in frepple::SolverMRP::SolverMRPdata.
Definition at line 166 of file utils/actions.cpp.
| bool frepple::utils::CommandList::getAbortOnError | ( | ) | const |
Returns whether or not a single failure aborts the complete command list.
Definition at line 62 of file utils/actions.cpp.
| string frepple::utils::CommandList::getDescription | ( | ) | const [inline, virtual] |
Returns a descriptive string on the command list.
Reimplemented from frepple::utils::Command.
| Command* frepple::utils::CommandList::getLastCommand | ( | ) | const [inline] |
| int frepple::utils::CommandList::getMaxParallel | ( | ) | const [inline] |
| int frepple::utils::CommandList::getNumberOfCommands | ( | ) | const [inline] |
| void frepple::utils::CommandList::setAbortOnError | ( | bool | b | ) | [inline] |
| void frepple::utils::CommandList::setMaxParallel | ( | int | b | ) | [inline] |
| void frepple::utils::CommandList::undo | ( | Command * | c | ) |
Undoes all actions in the list beyond the argument and clear the list of actions.
As soon as one of the actions on the list is not undo-able or the execution is not sequential, the undo is aborted and a warning message is printed.
There is no need that the actions have actually been executed before the undo() is called.
Definition at line 101 of file utils/actions.cpp.
| void frepple::utils::CommandList::undo | ( | ) | [inline, virtual] |
Undoes all actions on the list. At the end it also clears the list of actions. If one of the actions on the list is not undo-able, the whole list is non-undoable and a warning message will be printed.
Reimplemented from frepple::utils::Command.
| bool frepple::utils::CommandList::undoable | ( | const Command * | c | ) | const |
Returns true when all commands beyond the argument can be undone.
Definition at line 139 of file utils/actions.cpp.
| bool frepple::utils::CommandList::undoable | ( | ) | const [inline, virtual] |
Returns whether this command can be undone or not.
Reimplemented from frepple::utils::Command.
1.6.1