Salome HOME
merge from branch DEV tag mergeto_trunk_04apr08
[modules/yacs.git] / src / hmi / commands.hxx
1
2 #ifndef _COMMANDS_HXX_
3 #define _COMMANDS_HXX_
4
5 #include <list>
6 #include <stack>
7 #include <string>
8
9 namespace YACS
10 {
11   namespace HMI
12   {
13     class Command
14     {
15     public:
16       Command();
17       virtual bool execute();
18       virtual bool reverse();
19       //virtual std::string getCommandType() = 0; // utiliser un dynamic_cast plutot
20       void addSubCommand(Command* command);
21     protected:
22       virtual bool localExecute() = 0;
23       virtual bool localReverse() = 0;
24       std::list<Command*> _subCommands;
25     };
26     
27     class Invocator
28     {
29     public:
30       Invocator();
31       void add(Command* command);
32       bool undo();
33       bool redo();
34     protected:
35       std::stack<Command*> _commandsDone;
36       std::stack<Command*> _commandsUndone;
37     };
38   }
39 }
40 #endif