X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=action.cpp;h=87947ca054bb6684bfe9e23e006a16ff94df7c6c;hb=41efed0d6ee664fb79ea21a0e7239edcf51926d8;hp=2508b5c9fcdbd7cd56a1f6c3414a41977eb59ed4;hpb=84d555cb9ab1ce1bce673393a83d67e99d555d33;p=popboot.git diff --git a/action.cpp b/action.cpp index 2508b5c..87947ca 100644 --- a/action.cpp +++ b/action.cpp @@ -1,3 +1,39 @@ #include "action.h" +#include +using namespace std; +using namespace __gnu_cxx; +const Literals Action::_empty; +Action::Action(std::string name,const Preconditions& preconditions, std::string executable,const EffectsMap& effects){ + _name = name; + _executable = executable; + _preconditions = preconditions; + _effects = effects; +} + +Action::Action(const Action& action){ + _name = action._name; + _preconditions = action._preconditions; + _effects = action._effects; +} + +const Literals& Action::effects(int value) const{ + EffectsMap::const_iterator effects = _effects.find(value); + if (effects != _effects.end()) + return effects->second; + return _empty; +} + +const Preconditions& Action::preconditions() const{ + return _preconditions; +} + +int Action::execute() const{ + cout << "Executing: " << _executable << endl; + return 0; +} + +const string& Action::name() const{ + return _name; +}