]> ruin.nu Git - popboot.git/blob - action.cpp
87947ca054bb6684bfe9e23e006a16ff94df7c6c
[popboot.git] / action.cpp
1 #include "action.h"
2 #include <iostream>
3 using namespace std;
4 using namespace __gnu_cxx;
5
6 const Literals Action::_empty;
7
8 Action::Action(std::string name,const Preconditions& preconditions, std::string executable,const EffectsMap& effects){
9         _name = name;
10         _executable = executable;
11         _preconditions = preconditions;
12         _effects = effects;
13 }
14
15 Action::Action(const Action& action){
16         _name = action._name;
17         _preconditions = action._preconditions;
18         _effects = action._effects;
19 }
20
21 const Literals& Action::effects(int value) const{
22         EffectsMap::const_iterator effects = _effects.find(value);
23         if (effects != _effects.end())
24                 return effects->second;
25         return _empty;
26 }
27
28 const Preconditions& Action::preconditions() const{
29         return _preconditions;
30 }
31
32 int Action::execute() const{
33         cout << "Executing: " << _executable << endl;
34         return 0;
35 }
36
37 const string& Action::name() const{
38         return _name;
39 }