Public Types | Public Member Functions | Static Public Attributes | Friends

frepple::utils::Command Class Reference

Abstract base class for all commands. More...

#include <utils.h>

Inheritance diagram for frepple::utils::Command:
frepple::CommandCreateOperationPlan frepple::CommandDeleteOperationPlan frepple::CommandErase frepple::CommandMoveOperationPlan frepple::CommandPlanSize frepple::CommandReadXMLFile frepple::CommandReadXMLString frepple::CommandSave frepple::CommandSavePlan frepple::utils::CommandList frepple::utils::CommandLoadLibrary frepple::utils::CommandPython module_webservice::CommandWebservice

List of all members.

Public Types

enum  inheritableBool { INHERIT = -1, YES = 0, NO = 1 }

Public Member Functions

 Command ()
virtual void execute ()=0
bool getVerbose () const
void setVerbose (bool b)
virtual void undo ()
virtual bool undoable () const
virtual ~Command ()

Static Public Attributes

static const MetaCategorymetadataInstruction

Friends

class CommandList
class frepple::CommandMoveOperationPlan

Detailed Description

Abstract base class for all commands.

All changes in the system state are expected to be wrapped in a command object. The execute() and undo() methods update the model.
Adhering to this principle makes it easy to trace, time and log changes appropriately.
Command objects can't be persisted.

Definition at line 3576 of file utils.h.


Member Enumeration Documentation

This structure defines a boolean value that can be set to TRUE, FALSE or INHERITed from a higher level.

  • INHERIT: Inherit the value from a higher level list.
  • YES: true = 1
  • NO: false = 0
Enumerator:
INHERIT 
YES 
NO 

Definition at line 3587 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 3597 of file utils.h.

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

Destructor.

Definition at line 3625 of file utils.h.


Member Function Documentation

virtual void frepple::utils::Command::execute (  )  [pure virtual]

This method is used to actually execute the action.
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.

Implemented in frepple::CommandReadXMLFile, frepple::CommandReadXMLString, frepple::CommandSave, frepple::CommandSavePlan, frepple::CommandPlanSize, frepple::CommandErase, frepple::CommandCreateOperationPlan, frepple::CommandDeleteOperationPlan, frepple::CommandMoveOperationPlan, frepple::SolverMRP::SolverMRPdata, frepple::utils::CommandList, frepple::utils::CommandLoadLibrary, frepple::utils::CommandPython, and module_webservice::CommandWebservice.

bool frepple::utils::Command::getVerbose (  )  const

Returns whether verbose output is required during the execution of the command.

Reimplemented in frepple::SolverMRP::SolverMRPdata.

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

void frepple::utils::Command::setVerbose ( bool  b  )  [inline]

Controls whether verbose output will be generated during execution.

Definition at line 3632 of file utils.h.

virtual void frepple::utils::Command::undo (  )  [inline, virtual]

This method is undoing the state change of the execute() method.
Reversing the action is not possible for all commands. Command subclasses should override the undo() and undoable() method in case they are reversible.
A couple of notes on how this method should be implemented by the subclasses:

  • Calling the undo() method is harmless if the execute() hasn't been called yet.
  • Calling the undo() method multiple times is harmless and results in the same state change as calling it only once.

Reimplemented in frepple::CommandPlanSize, frepple::CommandCreateOperationPlan, frepple::CommandDeleteOperationPlan, frepple::CommandMoveOperationPlan, and frepple::utils::CommandList.

Definition at line 3618 of file utils.h.

virtual bool frepple::utils::Command::undoable (  )  const [inline, virtual]

Returns true if the execution of this command can be undone.

Reimplemented in frepple::CommandPlanSize, frepple::CommandCreateOperationPlan, frepple::CommandDeleteOperationPlan, frepple::CommandMoveOperationPlan, and frepple::utils::CommandList.

Definition at line 3622 of file utils.h.


Friends And Related Function Documentation

friend class CommandList [friend]

Definition at line 3578 of file utils.h.

friend class frepple::CommandMoveOperationPlan [friend]

Definition at line 3579 of file utils.h.


Member Data Documentation

A second metadata object for registering XML processing instructions.

Definition at line 3635 of file utils.h.


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