msgs_utils.cpp
Go to the documentation of this file.
00001 
00002 #include "msgs_utils.h"
00003 
00004 #include <algorithm>
00005 #include <iterator>
00006 
00007 using namespace std;
00008 
00009 namespace bwi_krexec {
00010 
00011 actasp::AspFluent TranslateFluent::operator()(const bwi_kr_execution::AspFluent& bwiFluent) {
00012   return actasp::AspFluent(bwiFluent.name,bwiFluent.variables,bwiFluent.timeStep);
00013 }
00014 
00015 bwi_kr_execution::AspFluent TranslateFluent::operator()(const actasp::AspFluent& actaspFluent) {
00016 
00017   bwi_kr_execution::AspFluent bwiFluent;
00018   bwiFluent.name = actaspFluent.getName();
00019   bwiFluent.timeStep = actaspFluent.getTimeStep();
00020   bwiFluent.variables = actaspFluent.getParameters();
00021 
00022   return bwiFluent;
00023 }
00024 
00025 
00026 actasp::AspRule TranslateRule::operator()(const bwi_kr_execution::AspRule& bwiRule) {
00027   actasp::AspRule actaspRule;
00028 
00029   transform(bwiRule.head.begin(), bwiRule.head.end(), back_inserter(actaspRule.head), TranslateFluent());
00030   transform(bwiRule.body.begin(), bwiRule.body.end(), back_inserter(actaspRule.body), TranslateFluent());
00031 
00032 
00033   return actaspRule;
00034 }
00035 
00036 bwi_kr_execution::AspRule TranslateRule::operator()(const actasp::AspRule& actaspRule) {
00037   bwi_kr_execution::AspRule bwiRule;
00038 
00039   transform(actaspRule.head.begin(), actaspRule.head.end(), back_inserter(bwiRule.head), TranslateFluent());
00040   transform(actaspRule.body.begin(), actaspRule.body.end(), back_inserter(bwiRule.body), TranslateFluent());
00041 
00042   return bwiRule;
00043 
00044 }
00045 
00046 actasp::AnswerSet TranslateAnswerSet::operator()(const bwi_kr_execution::AnswerSet& bwiAnswerSet) {
00047   
00048   if(!bwiAnswerSet.satisfied)
00049     return actasp::AnswerSet();
00050   
00051   list<actasp::AspFluent> fluents;
00052   transform(bwiAnswerSet.fluents.begin(), bwiAnswerSet.fluents.end(), back_inserter(fluents), TranslateFluent());
00053   
00054   return actasp::AnswerSet(fluents.begin(), fluents.end());
00055 }
00056 
00057 bwi_kr_execution::AnswerSet TranslateAnswerSet::operator()(const actasp::AnswerSet& actaspAnswerSet) {
00058   bwi_kr_execution::AnswerSet bwiAnswerSet;
00059   
00060   transform(actaspAnswerSet.getFluents().begin(),actaspAnswerSet.getFluents().end(),back_inserter(bwiAnswerSet.fluents),TranslateFluent());
00061   bwiAnswerSet.satisfied = actaspAnswerSet.isSatisfied();
00062   
00063   return bwiAnswerSet;
00064 }
00065 
00066 
00067 
00068 
00069 }


bwi_kr_execution
Author(s): Matteo Leonetti, Piyush Khandelwal
autogenerated on Thu Jun 6 2019 17:57:37