frepple::Command Class Reference
Abstract base class for all commands. More...
#include <utils.h>
Inheritance diagram for frepple::Command:

Public Types | |
| enum | inheritableBool { INHERIT = -1, YES = 0, NO = 1 } |
Public Member Functions | |
| Command () | |
| virtual void | endElement (XMLInput &pIn, const Attribute &pAttr, const DataElement &pElement) |
| virtual void | execute ()=0 |
| virtual string | getDescription () const |
| bool | getVerbose () const |
| void | setVerbose (bool b) |
| virtual void | undo () |
| virtual bool | undoable () const |
| virtual | ~Command () |
Static Public Attributes | |
| static const MetaCategory | metadata |
Friends | |
| class | CommandList |
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 2610 of file utils.h.
Member Enumeration Documentation
Constructor & Destructor Documentation
| frepple::Command::Command | ( | ) | [inline] |
Member Function Documentation
| void frepple::Command::endElement | ( | XMLInput & | pIn, | |
| const Attribute & | pAttr, | |||
| const DataElement & | pElement | |||
| ) | [virtual] |
Called while restoring the model from an XML-file. This is called when the corresponding close element tag is encountered, and the Data() member of pElement is also valid. NOTE: each object receives both its own beginElement so it can process its own element tag attributes, and its own endElement so it can process its own character data.
Implements frepple::Object.
Reimplemented in frepple::CommandSolve, frepple::CommandReadXMLFile, frepple::CommandReadXMLString, frepple::CommandSave, frepple::CommandSavePlan, frepple::CommandErase, frepple::CommandSetEnv, frepple::CommandList, frepple::CommandSystem, frepple::CommandLoadLibrary, and module_python::CommandPython.
Definition at line 55 of file utils/actions.cpp.
| virtual void frepple::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::CommandSolve, frepple::CommandReadXMLFile, frepple::CommandReadXMLString, frepple::CommandSave, frepple::CommandSavePlan, frepple::CommandPlanSize, frepple::CommandErase, frepple::CommandCreateOperationPlan, frepple::CommandDeleteOperationPlan, frepple::CommandMoveOperationPlan, frepple::SolverMRP::SolverMRPdata, frepple::CommandSetEnv, frepple::CommandList, frepple::CommandSystem, frepple::CommandLoadLibrary, module_python::CommandPython, and module_webservice::CommandWebservice.
| virtual string frepple::Command::getDescription | ( | ) | const [inline, virtual] |
Reimplemented in frepple::CommandSolve, frepple::CommandReadXMLFile, frepple::CommandReadXMLString, frepple::CommandSave, frepple::CommandSavePlan, frepple::CommandPlanSize, frepple::CommandErase, frepple::CommandCreateOperationPlan, frepple::CommandDeleteOperationPlan, frepple::CommandMoveOperationPlan, frepple::CommandSetEnv, frepple::CommandList, frepple::CommandSystem, frepple::CommandLoadLibrary, module_python::CommandPython, and module_webservice::CommandWebservice.
| bool frepple::Command::getVerbose | ( | ) | const |
Returns whether verbose output is required during the execution of the command.
Reimplemented in frepple::SolverMRP::SolverMRPdata.
Definition at line 43 of file utils/actions.cpp.
| void frepple::Command::setVerbose | ( | bool | b | ) | [inline] |
| virtual void frepple::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::CommandSolve, frepple::CommandPlanSize, frepple::CommandCreateOperationPlan, frepple::CommandDeleteOperationPlan, frepple::CommandMoveOperationPlan, and frepple::CommandList.
| virtual bool frepple::Command::undoable | ( | ) | const [inline, virtual] |
Returns true if the execution of this command can be undone.
Reimplemented in frepple::CommandSolve, frepple::CommandPlanSize, frepple::CommandCreateOperationPlan, frepple::CommandDeleteOperationPlan, frepple::CommandMoveOperationPlan, and frepple::CommandList.
Friends And Related Function Documentation
friend class CommandList [friend] |
Member Data Documentation
const MetaCategory frepple::Command::metadata [static] |
Reimplemented in frepple::CommandSolve, frepple::CommandReadXMLFile, frepple::CommandReadXMLString, frepple::CommandSave, frepple::CommandSavePlan, frepple::CommandPlanSize, frepple::CommandErase, frepple::CommandCreateOperationPlan, frepple::CommandDeleteOperationPlan, frepple::CommandMoveOperationPlan, frepple::CommandSetEnv, frepple::CommandList, frepple::CommandSystem, frepple::CommandLoadLibrary, module_python::CommandPython, and module_webservice::CommandWebservice.
The documentation for this class was generated from the following files:
Documentation generated by
