source: molecuilder/src/Actions/Action.cpp@ 521e29

Last change on this file since 521e29 was 521e29, checked in by Tillmann Crueger <crueger@…>, 16 years ago

Switched type of pointer used for ActionStates

  • Property mode set to 100644
File size: 897 bytes
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
13using namespace std;
14
15// An empty state to indicate success
16Action::state_ptr Action::success = Action::state_ptr(new ActionState());
17Action::state_ptr Action::failure = Action::state_ptr(new ActionState());
18
19Action::Action(std::string _name,bool _doRegister) :
20name(_name)
21{
22 if(_doRegister){
23 ActionRegistry::getInstance().registerAction(this);
24 }
25}
26
27Action::~Action()
28{}
29
30const string Action::getName(){
31 return name;
32}
33
34void Action::call(){
35 // forward to private virtual
36 performCall();
37}
38Action::state_ptr Action::undo(state_ptr _state) {
39 // forward to private virtual
40 return performUndo(_state);
41}
42Action::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.