diff --git a/BaseLib/ConfigTree.cpp b/BaseLib/ConfigTree.cpp index c43f8ff73a32e90c29d17bfc1c00d36b47f4c3ec..2cb931d91c5954a7f32e13b806aec98175615806 100644 --- a/BaseLib/ConfigTree.cpp +++ b/BaseLib/ConfigTree.cpp @@ -85,26 +85,6 @@ operator=(ConfigTree&& other) return *this; } -ConfigTree -ConfigTree:: -getConfParam(std::string const& root) const -{ - auto ct = getConfSubtree(root); - if (ct.hasChildren()) - error("Requested parameter <" + root + "> actually is a subtree."); - return ct; -} - -boost::optional<ConfigTree> -ConfigTree:: -getConfParamOptional(std::string const& root) const -{ - auto ct = getConfSubtreeOptional(root); - if (ct && ct->hasChildren()) - error("Requested parameter <" + root + "> actually is a subtree."); - return ct; -} - Range<ConfigTree::ParameterIterator> ConfigTree:: getConfParamList(const std::string ¶m) const diff --git a/BaseLib/ConfigTree.h b/BaseLib/ConfigTree.h index e2f637ba46f6b045430a74e3d99c9ee414f7d766..195b1e8b5ca16a0eb0db119ad70f802eb6d218ac 100644 --- a/BaseLib/ConfigTree.h +++ b/BaseLib/ConfigTree.h @@ -338,24 +338,6 @@ public: */ //!\{ - /*! Get parameter \c param from the configuration tree. - * - * \return the subtree representing the requested parameter - * - * \pre \c param must not have been read before from this ConfigTree. - */ - ConfigTree - getConfParam(std::string const& param) const; - - /*! Get parameter \c param from the configuration tree if present. - * - * \return the subtree representing the requested parameter - * - * \pre \c param must not have been read before from this ConfigTree. - */ - boost::optional<ConfigTree> - getConfParamOptional(std::string const& param) const; - /*! Fetches all parameters with name \c param from the current level of the tree. * * The return value is suitable to be used with range-base for-loops. diff --git a/Tests/BaseLib/TestConfigTree.cpp b/Tests/BaseLib/TestConfigTree.cpp index f70fba79469583505b030b5e74338ec8a68eba62..f37d517c12857d85f58b61bcdf4e4df93c7c5748 100644 --- a/Tests/BaseLib/TestConfigTree.cpp +++ b/Tests/BaseLib/TestConfigTree.cpp @@ -157,27 +157,27 @@ TEST(BaseLibConfigTree, Get) // Testing the getConfParam...() (non-template) / getValue() combination - auto bool1 = sub.getConfParam("bool1"); + auto bool1 = sub.getConfSubtree("bool1"); EXPECT_ERR_WARN(cbs, false, false); EXPECT_FALSE(bool1.getValue<bool>()); EXPECT_ERR_WARN(cbs, false, false); EXPECT_ANY_THROW(bool1.getValue<bool>()); // getting data twice EXPECT_ERR_WARN(cbs, true, false); - if (auto bool2 = sub.getConfParamOptional("bool2")) { + if (auto bool2 = sub.getConfSubtreeOptional("bool2")) { EXPECT_ERR_WARN(cbs, false, false); EXPECT_FALSE(bool2->getValue<bool>()); } EXPECT_ERR_WARN(cbs, false, false); - if (auto bool3 = sub.getConfParamOptional("bool3")) { + if (auto bool3 = sub.getConfSubtreeOptional("bool3")) { EXPECT_ERR_WARN(cbs, false, false); EXPECT_ANY_THROW(bool3->getValue<bool>()); EXPECT_ERR_WARN(cbs, true, false); // error because of no data } EXPECT_ERR_WARN(cbs, false, false); - EXPECT_FALSE(sub.getConfParamOptional("bool4")); // optional value not existent + EXPECT_FALSE(sub.getConfSubtreeOptional("bool4")); // optional value not existent EXPECT_ERR_WARN(cbs, false, false); @@ -206,7 +206,7 @@ TEST(BaseLibConfigTree, Get) // Testing attributes { - auto z = conf.getConfParam("z"); + auto z = conf.getConfSubtree("z"); EXPECT_ERR_WARN(cbs, false, false); EXPECT_EQ(0.5, z.getConfAttribute<double>("attr")); EXPECT_ERR_WARN(cbs, false, false); @@ -272,7 +272,7 @@ TEST(BaseLibConfigTree, IncompleteParse) EXPECT_ERR_WARN(cbs, false, true); // attribute "x" has not been read { - auto pt2 = conf.getConfParam("pt2"); + auto pt2 = conf.getConfSubtree("pt2"); EXPECT_EQ(0.5, pt2.getConfAttribute<double>("x")); EXPECT_ERR_WARN(cbs, false, false); EXPECT_EQ(1.0, pt2.getConfAttribute<double>("y")); @@ -523,11 +523,6 @@ TEST(BaseLibConfigTree, BadKeynames) EXPECT_ANY_THROW(conf.getConfParamList<int>(tag)); EXPECT_ERR_WARN(cbs, true, false); - EXPECT_ANY_THROW(conf.getConfParam(tag)); - EXPECT_ERR_WARN(cbs, true, false); - EXPECT_ANY_THROW(conf.getConfParamOptional(tag)); - EXPECT_ERR_WARN(cbs, true, false); - EXPECT_ANY_THROW(conf.peekConfParam<int>(tag)); EXPECT_ERR_WARN(cbs, true, false); EXPECT_ANY_THROW(conf.checkConfParam<int>(tag, 500));