knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
Bindings.cpp File Reference
#include "knowrob/terms/Bindings.h"
#include "knowrob/terms/Unifier.h"
#include "knowrob/knowrob.h"
#include "knowrob/formulas/CompoundFormula.h"
#include "knowrob/formulas/ModalFormula.h"
#include "knowrob/formulas/Implication.h"
#include "knowrob/formulas/Negation.h"
#include "knowrob/formulas/Conjunction.h"
#include "knowrob/formulas/Disjunction.h"
#include "knowrob/terms/Function.h"
#include "knowrob/integration/python/utils.h"
#include "knowrob/integration/python/converter/dict.h"
#include "knowrob/Logger.h"
Include dependency graph for Bindings.cpp:

Go to the source code of this file.

Namespaces

 knowrob
 
 knowrob::py
 

Functions

template<class T >
std::shared_ptr< T > applyCompoundBindings (const std::shared_ptr< T > &phi, const Bindings &bindings)
 
FormulaPtr knowrob::applyBindings (const FormulaPtr &phi, const Bindings &bindings)
 
TermPtr knowrob::applyBindings (const TermPtr &term, const Bindings &bindings)
 
TermPtr knowrob::py::applyBindings_t (const TermPtr &t, const Bindings &bindings)
 
FormulaPtr knowrob::py::applyBindings_phi (const FormulaPtr &phi, const Bindings &bindings)
 
template<>
void knowrob::py::createType< Bindings > ()
 

Function Documentation

◆ applyCompoundBindings()

template<class T >
std::shared_ptr<T> applyCompoundBindings ( const std::shared_ptr< T > &  phi,
const Bindings bindings 
)

Definition at line 167 of file Bindings.cpp.

169  {
170  std::vector<FormulaPtr> formulae;
171  bool hasNewFormula = false;
172  for (const auto &f: phi->formulae()) {
173  auto f1 = applyBindings(f, bindings);
174  if (f1 != f) {
175  hasNewFormula = true;
176  }
177  formulae.push_back(applyBindings(f, bindings));
178  }
179  if (!hasNewFormula) {
180  return phi;
181  } else {
182  return std::make_shared<T>(formulae);
183  }
184 }
FirstOrderLiteralPtr applyBindings(const FirstOrderLiteralPtr &lit, const Bindings &bindings)