DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
Command Class Referenceabstract

An abstract class that implements an interface for commands that can be undone and redone. More...

#include <command.h>

Inheritance diagram for Command:
SetNodeValueCommand SetTreeTypeCommand

Public Member Functions

 Command ()
 
virtual ~Command ()
 
virtual bool execute ()=0
 Execute the command. More...
 
virtual bool undo ()=0
 Undo the command. More...
 
virtual bool redo ()=0
 Redo the command. More...
 

Detailed Description

An abstract class that implements an interface for commands that can be undone and redone.

This class imeplements a Command design pattern. Each command that can be undone and re-done must derive from this class.

Constructor & Destructor Documentation

◆ Command()

Command::Command ( )

◆ ~Command()

Command::~Command ( )
virtual

Member Function Documentation

◆ execute()

virtual bool Command::execute ( )
pure virtual

Execute the command.

If the command executed correctly, the client will put the command in the Undo list.

Returns
true if the command executed correctly, false if an error occurred.

Implemented in SetTreeTypeCommand, and SetNodeValueCommand.

◆ redo()

virtual bool Command::redo ( )
pure virtual

Redo the command.

If the command redid correctly, the client will move it from the redo list to the undo list.

Returns
true if the command executed correctly, false if an error occurred.

Implemented in SetTreeTypeCommand, and SetNodeValueCommand.

◆ undo()

virtual bool Command::undo ( )
pure virtual

Undo the command.

If the command undid correctly, the client will move the command in the Redo list. Otherwise the entire Undo list must be cleaned.

Returns
true if the command executed correctly, false if an error occurred.

Implemented in SetTreeTypeCommand, and SetNodeValueCommand.


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