diff --git a/include/plasp/pddl/expressions/DerivedPredicate.h b/include/plasp/pddl/expressions/DerivedPredicate.h index 53087f7..3bc3765 100644 --- a/include/plasp/pddl/expressions/DerivedPredicate.h +++ b/include/plasp/pddl/expressions/DerivedPredicate.h @@ -24,12 +24,18 @@ class DerivedPredicate: public ExpressionCRTP // TODO: consider implementing parsing functions for compatibility with older PDDL versions public: + explicit DerivedPredicate(size_t id); + + size_t id() const; + void setArgument(ExpressionPointer argument); ExpressionPointer argument() const; void print(std::ostream &ostream) const override; private: + size_t m_id; + ExpressionPointer m_argument; }; diff --git a/src/plasp/pddl/expressions/DerivedPredicate.cpp b/src/plasp/pddl/expressions/DerivedPredicate.cpp index c211c9b..cf0d10b 100644 --- a/src/plasp/pddl/expressions/DerivedPredicate.cpp +++ b/src/plasp/pddl/expressions/DerivedPredicate.cpp @@ -16,6 +16,20 @@ namespace expressions // //////////////////////////////////////////////////////////////////////////////////////////////////// +DerivedPredicate::DerivedPredicate(size_t id) +: m_id{id} +{ +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +size_t DerivedPredicate::id() const +{ + return m_id; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + void DerivedPredicate::setArgument(ExpressionPointer argument) { m_argument = argument; diff --git a/src/plasp/pddl/expressions/ForAll.cpp b/src/plasp/pddl/expressions/ForAll.cpp index 4013f7f..6ce8550 100644 --- a/src/plasp/pddl/expressions/ForAll.cpp +++ b/src/plasp/pddl/expressions/ForAll.cpp @@ -24,7 +24,7 @@ const std::string ForAll::Identifier = "forall"; ExpressionPointer ForAll::decomposed(DerivedPredicates &derivedPredicates) { - auto derivedPredicate = DerivedPredicatePointer(new DerivedPredicate); + auto derivedPredicate = DerivedPredicatePointer(new DerivedPredicate(derivedPredicates.size())); derivedPredicates.push_back(derivedPredicate); derivedPredicate->setArgument(this); diff --git a/src/plasp/pddl/expressions/Or.cpp b/src/plasp/pddl/expressions/Or.cpp index 5fbedb3..f7c0293 100644 --- a/src/plasp/pddl/expressions/Or.cpp +++ b/src/plasp/pddl/expressions/Or.cpp @@ -28,7 +28,7 @@ ExpressionPointer Or::decomposed(DerivedPredicates &derivedPredicates) argument = argument->decomposed(derivedPredicates); }); - auto derivedPredicate = DerivedPredicatePointer(new DerivedPredicate); + auto derivedPredicate = DerivedPredicatePointer(new DerivedPredicate(derivedPredicates.size())); derivedPredicates.push_back(derivedPredicate); derivedPredicate->setArgument(this);