Public Member Functions

frepple::utils::CommandList Class Reference

A container command to group a series of commands together. More...

#include <utils.h>

Inheritance diagram for frepple::utils::CommandList:
frepple::utils::Command frepple::SolverMRP::SolverMRPdata

List of all members.

Public Member Functions

void add (Command *c)
 CommandList ()
bool empty () const
void execute ()
bool getAbortOnError () const
CommandgetLastCommand () 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 ()

Detailed Description

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 3678 of file utils.h.


Constructor & Destructor Documentation

frepple::utils::CommandList::CommandList (  )  [inline, explicit]

Default constructor.

Definition at line 3810 of file utils.h.

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 369 of file utils/actions.cpp.


Member Function Documentation

void frepple::utils::CommandList::add ( Command c  ) 

Append an additional command to the end of the list.

Definition at line 77 of file utils/actions.cpp.

bool frepple::utils::CommandList::empty (  )  const [inline]

Returns true if no commands have been added yet to the list.

Definition at line 3807 of file utils.h.

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 167 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 63 of file utils/actions.cpp.

Command* frepple::utils::CommandList::getLastCommand (  )  const [inline]

Returns the last command that was added to the list.

Definition at line 3747 of file utils.h.

int frepple::utils::CommandList::getMaxParallel (  )  const [inline]

Returns whether the command list processes its commands sequentially or in parallel. The default is sequentially, and this field is NOT inherited down nested command list hierarchies.

Definition at line 3783 of file utils.h.

int frepple::utils::CommandList::getNumberOfCommands (  )  const [inline]

Returns the number of commands stored in this list.

Definition at line 3736 of file utils.h.

void frepple::utils::CommandList::setAbortOnError ( bool  b  )  [inline]

If this field is set to true the failure of a single command in the list will abort the complete list of command.
If set to false, the remaining commands will still be run in case of a failure.

Definition at line 3778 of file utils.h.

void frepple::utils::CommandList::setMaxParallel ( int  b  )  [inline]

Updates whether the command list process its commands sequentially or in parallel.

Definition at line 3787 of file utils.h.

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.

Definition at line 3753 of file utils.h.

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 102 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.

Definition at line 3801 of file utils.h.

bool frepple::utils::CommandList::undoable ( const Command c  )  const

Returns true when all commands beyond the argument can be undone.

Definition at line 140 of file utils/actions.cpp.


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