From 680206b40bdf6d56f7e3120d98c17daeca0293ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Mon, 13 Jun 2016 01:38:56 +0200 Subject: [PATCH] Removed Reference expressions. --- include/plasp/pddl/Expression.h | 6 -- include/plasp/pddl/expressions/Binary.h | 40 +++++++--- include/plasp/pddl/expressions/NAry.h | 29 +++++++- include/plasp/pddl/expressions/Not.h | 12 ++- include/plasp/pddl/expressions/Predicate.h | 4 +- include/plasp/pddl/expressions/Reference.h | 70 ------------------ include/plasp/pddl/expressions/Type.h | 2 +- src/plasp/pddl/Expression.cpp | 1 - src/plasp/pddl/expressions/Not.cpp | 27 ++++++- src/plasp/pddl/expressions/Predicate.cpp | 12 +-- .../pddl/expressions/PredicateDeclaration.cpp | 1 - src/plasp/pddl/expressions/Type.cpp | 7 +- tests/TestPDDLParser.cpp | 73 +++++++++---------- 13 files changed, 134 insertions(+), 150 deletions(-) delete mode 100644 include/plasp/pddl/expressions/Reference.h diff --git a/include/plasp/pddl/Expression.h b/include/plasp/pddl/Expression.h index 8f54597..d5e128c 100644 --- a/include/plasp/pddl/Expression.h +++ b/include/plasp/pddl/Expression.h @@ -59,11 +59,6 @@ class PrimitiveType; using PrimitiveTypePointer = std::unique_ptr; using PrimitiveTypes = std::vector; -template -class Reference; -template -using ReferencePointer = std::unique_ptr>; - class Variable; using VariablePointer = std::unique_ptr; using Variables = std::vector; @@ -86,7 +81,6 @@ class Expression PredicateDeclaration, Predicate, PrimitiveType, - Reference, Variable }; diff --git a/include/plasp/pddl/expressions/Binary.h b/include/plasp/pddl/expressions/Binary.h index e265a93..c4fced2 100644 --- a/include/plasp/pddl/expressions/Binary.h +++ b/include/plasp/pddl/expressions/Binary.h @@ -29,12 +29,16 @@ class Binary: public ExpressionCRTP ExpressionContext &expressionContext, ExpressionParser parseExpression); public: - const Expression *leftArgument() const; - const Expression *rightArgument() const; + const std::array &arguments() const; private: - ExpressionPointer m_leftArgument; - ExpressionPointer m_rightArgument; + template + void setArgument(const Expression *argument); + template + void setArgument(ExpressionPointer &&argument); + + std::array m_arguments; + std::array m_argumentStorage; }; //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -59,8 +63,8 @@ std::unique_ptr Binary::parse(Context &context, // Assume that expression identifier (imply, exists, etc.) is already parsed // Parse arguments of the expression - expression->m_leftArgument = parseExpression(context, expressionContext); - expression->m_rightArgument = parseExpression(context, expressionContext); + expression->setArgument<0>(parseExpression(context, expressionContext)); + expression->setArgument<1>(parseExpression(context, expressionContext)); parser.expect(")"); @@ -70,17 +74,33 @@ std::unique_ptr Binary::parse(Context &context, //////////////////////////////////////////////////////////////////////////////////////////////////// template -const Expression *Binary::leftArgument() const +template +void Binary::setArgument(const Expression *expression) { - return m_leftArgument.get(); + static_assert(i <= 2, "Index out of range"); + + m_argumentStorage[i] = nullptr; + m_arguments[i] = expression; } //////////////////////////////////////////////////////////////////////////////////////////////////// template -const Expression *Binary::rightArgument() const +template +void Binary::setArgument(ExpressionPointer &&expression) { - return m_rightArgument.get(); + static_assert(i <= 2, "Index out of range"); + + m_argumentStorage[i] = std::move(expression); + m_arguments[i] = m_argumentStorage[i].get(); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +template +const std::array &Binary::arguments() const +{ + return m_arguments; } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/include/plasp/pddl/expressions/NAry.h b/include/plasp/pddl/expressions/NAry.h index d970ed3..cdec036 100644 --- a/include/plasp/pddl/expressions/NAry.h +++ b/include/plasp/pddl/expressions/NAry.h @@ -29,10 +29,14 @@ class NAry: public ExpressionCRTP ExpressionContext &expressionContext, ExpressionParser parseExpression); public: - const Expressions &arguments() const; + const std::vector &arguments() const; private: - Expressions m_arguments; + void addArgument(const Expression *argument); + void addArgument(ExpressionPointer &&argument); + + std::vector m_arguments; + Expressions m_argumentStorage; }; //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -61,7 +65,7 @@ std::unique_ptr NAry::parse(Context &context, // Parse arguments of the expression while (parser.currentCharacter() != ')') { - expression->m_arguments.emplace_back(parseExpression(context, expressionContext)); + expression->addArgument(parseExpression(context, expressionContext)); parser.skipWhiteSpace(); } @@ -77,7 +81,24 @@ std::unique_ptr NAry::parse(Context &context, //////////////////////////////////////////////////////////////////////////////////////////////////// template -const Expressions &NAry::arguments() const +void NAry::addArgument(const Expression *argument) +{ + m_arguments.emplace_back(argument); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +template +void NAry::addArgument(ExpressionPointer &&argument) +{ + m_argumentStorage.emplace_back(std::move(argument)); + m_arguments.emplace_back(m_argumentStorage.back().get()); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +template +const std::vector &NAry::arguments() const { return m_arguments; } diff --git a/include/plasp/pddl/expressions/Not.h b/include/plasp/pddl/expressions/Not.h index ee60814..f8a6beb 100644 --- a/include/plasp/pddl/expressions/Not.h +++ b/include/plasp/pddl/expressions/Not.h @@ -28,10 +28,16 @@ class Not: public ExpressionCRTP ExpressionParser parseExpression); public: - const Expression &argument() const; + Not(); + + const Expression *argument() const; private: - ExpressionPointer m_argument; + void setArgument(const Expression *argument); + void setArgument(ExpressionPointer &&argument); + + const Expression *m_argument; + ExpressionPointer m_argumentStorage; }; //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -56,7 +62,7 @@ NotPointer Not::parse(Context &context, ExpressionContext &expressionContext, context.parser.skipWhiteSpace(); // Parse argument - expression->m_argument = parseExpression(context, expressionContext); + expression->setArgument(parseExpression(context, expressionContext)); parser.expect(")"); diff --git a/include/plasp/pddl/expressions/Predicate.h b/include/plasp/pddl/expressions/Predicate.h index fca134f..fc4f886 100644 --- a/include/plasp/pddl/expressions/Predicate.h +++ b/include/plasp/pddl/expressions/Predicate.h @@ -26,7 +26,7 @@ class Predicate: public ExpressionCRTP public: const std::string &name() const; - const Expressions &arguments() const; + const std::vector &arguments() const; bool isDeclared() const; @@ -38,7 +38,7 @@ class Predicate: public ExpressionCRTP bool m_isDeclared; std::string m_name; - Expressions m_arguments; + std::vector m_arguments; }; //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/include/plasp/pddl/expressions/Reference.h b/include/plasp/pddl/expressions/Reference.h deleted file mode 100644 index d437790..0000000 --- a/include/plasp/pddl/expressions/Reference.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef __PLASP__PDDL__EXPRESSIONS__REFERENCE_H -#define __PLASP__PDDL__EXPRESSIONS__REFERENCE_H - -#include - -#include -#include - -namespace plasp -{ -namespace pddl -{ -namespace expressions -{ - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// -// Reference -// -//////////////////////////////////////////////////////////////////////////////////////////////////// - -// TODO: refactor without reference wrapper -template -class Reference: public ExpressionCRTP> -{ - public: - static const Expression::Type ExpressionType = Expression::Type::Reference; - - Reference(const Type *value); - - const Type *value() const; - - private: - Reference(); - - const Type *m_value; -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -template -Reference::Reference() -: m_value{nullptr} -{ -} - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -template -Reference::Reference(const Type *value) -: m_value{value} -{ - BOOST_ASSERT(m_value != nullptr); -} - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -template -const Type *Reference::value() const -{ - return m_value; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -} -} -} - -#endif diff --git a/include/plasp/pddl/expressions/Type.h b/include/plasp/pddl/expressions/Type.h index 54c09cd..fbd43c1 100644 --- a/include/plasp/pddl/expressions/Type.h +++ b/include/plasp/pddl/expressions/Type.h @@ -16,7 +16,7 @@ namespace expressions // //////////////////////////////////////////////////////////////////////////////////////////////////// -ExpressionPointer parseExistingPrimitiveType(Context &context, +const Expression *parseExistingPrimitiveType(Context &context, ExpressionContext &expressionContext); //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/plasp/pddl/Expression.cpp b/src/plasp/pddl/Expression.cpp index eff798b..38c135e 100644 --- a/src/plasp/pddl/Expression.cpp +++ b/src/plasp/pddl/Expression.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include diff --git a/src/plasp/pddl/expressions/Not.cpp b/src/plasp/pddl/expressions/Not.cpp index 5d54747..d547eda 100644 --- a/src/plasp/pddl/expressions/Not.cpp +++ b/src/plasp/pddl/expressions/Not.cpp @@ -13,9 +13,32 @@ namespace expressions // //////////////////////////////////////////////////////////////////////////////////////////////////// -const Expression &Not::argument() const +Not::Not() +: m_argument{nullptr} { - return *m_argument; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +void Not::setArgument(const Expression *argument) +{ + m_argumentStorage = nullptr; + m_argument = argument; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +void Not::setArgument(ExpressionPointer &&argument) +{ + m_argumentStorage = std::move(argument); + m_argument = m_argumentStorage.get(); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +const Expression *Not::argument() const +{ + return m_argument; } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/plasp/pddl/expressions/Predicate.cpp b/src/plasp/pddl/expressions/Predicate.cpp index b17cf1e..ee4a314 100644 --- a/src/plasp/pddl/expressions/Predicate.cpp +++ b/src/plasp/pddl/expressions/Predicate.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include namespace plasp @@ -69,8 +68,7 @@ PredicatePointer Predicate::parse(Context &context, ExpressionContext &expressio if (context.parser.currentCharacter() == '?') { const auto *variable = Variable::parseAndFind(context, expressionContext); - auto variableReference = std::make_unique>(variable); - predicate->m_arguments.emplace_back(std::move(variableReference)); + predicate->m_arguments.emplace_back(variable); } // Parse constants else @@ -78,8 +76,7 @@ PredicatePointer Predicate::parse(Context &context, ExpressionContext &expressio const auto *constant = (expressionContext.problem == nullptr) ? Constant::parseAndFind(context, expressionContext.domain) : Constant::parseAndFind(context, *expressionContext.problem); - auto constantReference = std::make_unique>(constant); - predicate->m_arguments.emplace_back(std::move(constantReference)); + predicate->m_arguments.emplace_back(constant); } context.parser.skipWhiteSpace(); @@ -134,8 +131,7 @@ PredicatePointer Predicate::parse(Context &context, const Problem &problem) // Parse objects and constants const auto *constant = Constant::parseAndFind(context, problem); - auto constantReference = std::make_unique>(constant); - predicate->m_arguments.emplace_back(std::move(constantReference)); + predicate->m_arguments.emplace_back(constant); } // TODO: check that signature matches one of the declared ones @@ -168,7 +164,7 @@ const std::string &Predicate::name() const //////////////////////////////////////////////////////////////////////////////////////////////////// -const Expressions &Predicate::arguments() const +const std::vector &Predicate::arguments() const { return m_arguments; } diff --git a/src/plasp/pddl/expressions/PredicateDeclaration.cpp b/src/plasp/pddl/expressions/PredicateDeclaration.cpp index b60de2a..643026f 100644 --- a/src/plasp/pddl/expressions/PredicateDeclaration.cpp +++ b/src/plasp/pddl/expressions/PredicateDeclaration.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include namespace plasp diff --git a/src/plasp/pddl/expressions/Type.cpp b/src/plasp/pddl/expressions/Type.cpp index 18ededa..49b81f0 100644 --- a/src/plasp/pddl/expressions/Type.cpp +++ b/src/plasp/pddl/expressions/Type.cpp @@ -3,7 +3,6 @@ #include #include #include -#include namespace plasp { @@ -18,11 +17,9 @@ namespace expressions // //////////////////////////////////////////////////////////////////////////////////////////////////// -ExpressionPointer parseExistingPrimitiveType(Context &context, ExpressionContext &expressionContext) +const Expression *parseExistingPrimitiveType(Context &context, ExpressionContext &expressionContext) { - auto *primitiveType = PrimitiveType::parseAndFind(context, expressionContext.domain); - - return std::make_unique>(primitiveType); + return PrimitiveType::parseAndFind(context, expressionContext.domain); } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/tests/TestPDDLParser.cpp b/tests/TestPDDLParser.cpp index d92e5a5..8ef2721 100644 --- a/tests/TestPDDLParser.cpp +++ b/tests/TestPDDLParser.cpp @@ -11,7 +11,6 @@ #include #include #include -#include using namespace plasp::pddl; @@ -49,11 +48,11 @@ TEST(PDDLParserTests, ParseBlocksWorldDomain) ASSERT_EQ(on.name(), "on"); ASSERT_EQ(on.arguments().size(), 2u); ASSERT_EQ(on.arguments()[0]->name(), "x"); - const auto *onArgument0Type = dynamic_cast(on.arguments()[0]->type()); - ASSERT_EQ(onArgument0Type, &block); + const auto &onArgument0Type = dynamic_cast(*on.arguments()[0]->type()); + ASSERT_EQ(&onArgument0Type, &block); ASSERT_EQ(on.arguments()[1]->name(), "y"); - const auto onArgument1Type = dynamic_cast(on.arguments()[1]->type()); - ASSERT_EQ(onArgument1Type, &block); + const auto &onArgument1Type = dynamic_cast(*on.arguments()[1]->type()); + ASSERT_EQ(&onArgument1Type, &block); const auto &handempty = *domain.predicates()[3]; @@ -75,7 +74,7 @@ TEST(PDDLParserTests, ParseBlocksWorldDomain) const auto &pickUpPre0 = dynamic_cast(*pickUpPre.arguments()[0]); ASSERT_EQ(pickUpPre0.name(), "clear"); ASSERT_EQ(pickUpPre0.arguments().size(), 1u); - const auto &pickUpPre00 = *dynamic_cast &>(*pickUpPre0.arguments()[0]).value(); + const auto &pickUpPre00 = dynamic_cast(*pickUpPre0.arguments()[0]); ASSERT_EQ(pickUpPre00.name(), "x"); ASSERT_EQ(pickUpPre00.type(), &block); ASSERT_EQ(&pickUpPre00, pickUp.parameters()[0].get()); @@ -86,10 +85,10 @@ TEST(PDDLParserTests, ParseBlocksWorldDomain) const auto &pickUpEff = dynamic_cast(*pickUp.effect()); ASSERT_EQ(pickUpEff.arguments().size(), 4u); const auto &pickUpEff0 = dynamic_cast(*pickUpEff.arguments()[0]); - const auto &pickUpEff00 = dynamic_cast(pickUpEff0.argument()); + const auto &pickUpEff00 = dynamic_cast(*pickUpEff0.argument()); ASSERT_EQ(pickUpEff00.name(), "ontable"); ASSERT_EQ(pickUpEff00.arguments().size(), 1u); - const auto &pickUpEff000 = *dynamic_cast &>(*pickUpEff00.arguments()[0]).value(); + const auto &pickUpEff000 = dynamic_cast(*pickUpEff00.arguments()[0]); ASSERT_EQ(pickUpEff000.name(), "x"); ASSERT_EQ(pickUpEff000.type(), &block); } @@ -125,14 +124,14 @@ TEST(PDDLParserTests, ParseBlocksWorldProblem) const auto &facts = problem.initialState().facts(); ASSERT_EQ(facts.size(), 9u); - const auto &fact0 = *dynamic_cast(facts[0].get()); + const auto &fact0 = dynamic_cast(*facts[0].get()); ASSERT_EQ(fact0.name(), "clear"); ASSERT_EQ(fact0.arguments().size(), 1u); - const auto &fact00 = *dynamic_cast *>(fact0.arguments()[0].get())->value(); + const auto &fact00 = dynamic_cast(*fact0.arguments()[0]); ASSERT_EQ(fact00.name(), "c"); ASSERT_NE(fact00.type(), nullptr); ASSERT_EQ(fact00.type()->name(), "block"); - const auto &fact8 = *dynamic_cast(facts[8].get()); + const auto &fact8 = dynamic_cast(*facts[8].get()); ASSERT_EQ(fact8.name(), "handempty"); ASSERT_EQ(fact8.arguments().size(), 0u); @@ -140,19 +139,19 @@ TEST(PDDLParserTests, ParseBlocksWorldProblem) const auto &goal = dynamic_cast(problem.goal()); ASSERT_EQ(goal.arguments().size(), 3u); - const auto &goal0 = *dynamic_cast(goal.arguments()[0].get()); + const auto &goal0 = dynamic_cast(*goal.arguments()[0]); ASSERT_EQ(goal0.name(), "on"); ASSERT_EQ(goal0.arguments().size(), 2u); - const auto &goal00 = *dynamic_cast *>(goal0.arguments()[0].get())->value(); + const auto &goal00 = dynamic_cast(*goal0.arguments()[0]); ASSERT_EQ(goal00.name(), "d"); - const auto &goal01 = *dynamic_cast *>(goal0.arguments()[1].get())->value(); + const auto &goal01 = dynamic_cast(*goal0.arguments()[1]); ASSERT_EQ(goal01.name(), "c"); - const auto &goal2 = *dynamic_cast(goal.arguments()[2].get()); + const auto &goal2 = dynamic_cast(*goal.arguments()[2]); ASSERT_EQ(goal2.name(), "on"); ASSERT_EQ(goal2.arguments().size(), 2u); - const auto &goal20 = *dynamic_cast *>(goal2.arguments()[0].get())->value(); + const auto &goal20 = dynamic_cast(*goal2.arguments()[0]); ASSERT_EQ(goal20.name(), "b"); - const auto &goal21 = *dynamic_cast *>(goal2.arguments()[1].get())->value(); + const auto &goal21 = dynamic_cast(*goal2.arguments()[1]); ASSERT_EQ(goal21.name(), "a"); } @@ -200,22 +199,22 @@ TEST(PDDLParserTests, ParseStorageDomain) ASSERT_EQ(on.name(), "on"); ASSERT_EQ(on.arguments().size(), 2u); ASSERT_EQ(on.arguments()[0]->name(), "c"); - const auto onArgument0Type = dynamic_cast(on.arguments()[0]->type()); - ASSERT_EQ(onArgument0Type, &crate); + const auto &onArgument0Type = dynamic_cast(*on.arguments()[0]->type()); + ASSERT_EQ(&onArgument0Type, &crate); ASSERT_EQ(on.arguments()[1]->name(), "s"); - const auto onArgument1Type = dynamic_cast(on.arguments()[1]->type()); - ASSERT_EQ(onArgument1Type, &storearea); + const auto &onArgument1Type = dynamic_cast(*on.arguments()[1]->type()); + ASSERT_EQ(&onArgument1Type, &storearea); const auto &in = *domain.predicates()[1]; ASSERT_EQ(in.name(), "in"); ASSERT_EQ(in.arguments().size(), 2u); ASSERT_EQ(in.arguments()[0]->name(), "x"); - const auto inArgument0Type = dynamic_cast(in.arguments()[0]->type()); - ASSERT_EQ(inArgument0Type->arguments().size(), 2u); - const auto inArgument0Type0 = dynamic_cast *>(inArgument0Type->arguments()[0].get())->value(); - ASSERT_EQ(inArgument0Type0, &storearea); - const auto inArgument0Type1 = dynamic_cast *>(inArgument0Type->arguments()[1].get())->value(); - ASSERT_EQ(inArgument0Type1, &crate); + const auto &inArgument0Type = dynamic_cast(*in.arguments()[0]->type()); + ASSERT_EQ(inArgument0Type.arguments().size(), 2u); + const auto &inArgument0Type0 = dynamic_cast(*inArgument0Type.arguments()[0]); + ASSERT_EQ(&inArgument0Type0, &storearea); + const auto &inArgument0Type1 = dynamic_cast(*inArgument0Type.arguments()[1]); + ASSERT_EQ(&inArgument0Type1, &crate); // Actions ASSERT_EQ(domain.actions().size(), 5u); @@ -232,17 +231,17 @@ TEST(PDDLParserTests, ParseStorageDomain) const auto &dropPre2 = dynamic_cast(*dropPre.arguments()[2]); ASSERT_EQ(dropPre2.name(), "lifting"); ASSERT_EQ(dropPre2.arguments().size(), 2u); - const auto &dropPre21 = *dynamic_cast &>(*dropPre2.arguments()[1]).value(); + const auto &dropPre21 = dynamic_cast(*dropPre2.arguments()[1]); ASSERT_EQ(dropPre21.name(), "c"); ASSERT_EQ(dropPre21.type(), &crate); const auto &dropEff = dynamic_cast(*drop.effect()); ASSERT_EQ(dropEff.arguments().size(), 5u); const auto &dropEff2 = dynamic_cast(*dropEff.arguments()[2]); - const auto &dropEff20 = dynamic_cast(dropEff2.argument()); + const auto &dropEff20 = dynamic_cast(*dropEff2.argument()); ASSERT_EQ(dropEff20.name(), "clear"); ASSERT_EQ(dropEff20.arguments().size(), 1u); - const auto &dropEff200 = *dynamic_cast &>(*dropEff20.arguments()[0]).value(); + const auto &dropEff200 = dynamic_cast(*dropEff20.arguments()[0]); ASSERT_EQ(dropEff200.name(), "a1"); ASSERT_EQ(dropEff200.type(), &storearea); } @@ -278,17 +277,17 @@ TEST(PDDLParserTests, ParseStorageProblem) const auto &facts = problem.initialState().facts(); ASSERT_EQ(facts.size(), 10u); - const auto &fact0 = *dynamic_cast(facts[0].get()); + const auto &fact0 = dynamic_cast(*facts[0].get()); ASSERT_EQ(fact0.name(), "in"); ASSERT_EQ(fact0.arguments().size(), 2u); - const auto &fact01 = *dynamic_cast *>(fact0.arguments()[1].get())->value(); + const auto &fact01 = dynamic_cast(*fact0.arguments()[1]); ASSERT_EQ(fact01.name(), "depot0"); ASSERT_NE(fact01.type(), nullptr); ASSERT_EQ(fact01.type()->name(), "depot"); - const auto &fact9 = *dynamic_cast(facts[9].get()); + const auto &fact9 = dynamic_cast(*facts[9].get()); ASSERT_EQ(fact9.name(), "available"); ASSERT_EQ(fact9.arguments().size(), 1u); - const auto &fact90 = *dynamic_cast *>(fact9.arguments()[0].get())->value(); + const auto &fact90 = dynamic_cast(*fact9.arguments()[0]); ASSERT_EQ(fact90.name(), "hoist0"); ASSERT_NE(fact90.type(), nullptr); ASSERT_EQ(fact90.type()->name(), "hoist"); @@ -297,12 +296,12 @@ TEST(PDDLParserTests, ParseStorageProblem) const auto &goal = dynamic_cast(problem.goal()); ASSERT_EQ(goal.arguments().size(), 1u); - const auto &goal0 = *dynamic_cast(goal.arguments()[0].get()); + const auto &goal0 = dynamic_cast(*goal.arguments()[0]); ASSERT_EQ(goal0.name(), "in"); ASSERT_EQ(goal0.arguments().size(), 2u); - const auto &goal00 = *dynamic_cast *>(goal0.arguments()[0].get())->value(); + const auto &goal00 = dynamic_cast(*goal0.arguments()[0]); ASSERT_EQ(goal00.name(), "crate0"); - const auto &goal01 = *dynamic_cast *>(goal0.arguments()[1].get())->value(); + const auto &goal01 = dynamic_cast(*goal0.arguments()[1]); ASSERT_EQ(goal01.name(), "depot0"); }