| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * Action.cpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Dec 8, 2009
|
|---|
| 5 | * Author: crueger
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #include <string>
|
|---|
| 9 |
|
|---|
| 10 | #include "Actions/Action.hpp"
|
|---|
| 11 | #include "Actions/ActionRegistry.hpp"
|
|---|
| 12 |
|
|---|
| 13 | using namespace std;
|
|---|
| 14 |
|
|---|
| 15 | // An empty state to indicate success
|
|---|
| 16 | Action::state_ptr Action::success = Action::state_ptr(new ActionState());
|
|---|
| 17 | Action::state_ptr Action::failure = Action::state_ptr(new ActionState());
|
|---|
| 18 |
|
|---|
| 19 | Action::Action(std::string _name,bool _doRegister) :
|
|---|
| 20 | name(_name)
|
|---|
| 21 | {
|
|---|
| 22 | if(_doRegister){
|
|---|
| 23 | ActionRegistry::getInstance().registerAction(this);
|
|---|
| 24 | }
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | Action::~Action()
|
|---|
| 28 | {}
|
|---|
| 29 |
|
|---|
| 30 | const string Action::getName(){
|
|---|
| 31 | return name;
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | void Action::call(){
|
|---|
| 35 | // forward to private virtual
|
|---|
| 36 | performCall();
|
|---|
| 37 | }
|
|---|
| 38 | Action::state_ptr Action::undo(state_ptr _state) {
|
|---|
| 39 | // forward to private virtual
|
|---|
| 40 | return performUndo(_state);
|
|---|
| 41 | }
|
|---|
| 42 | Action::state_ptr Action::redo(state_ptr _state) {
|
|---|
| 43 | // forward to private virtual
|
|---|
| 44 | return performRedo(_state);
|
|---|
| 45 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.