From bc36f05eb657764a0e4a2c1e9e2fd9d6406eaec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu> Date: Wed, 10 Jun 2020 14:29:46 +0200 Subject: [PATCH] Remove size() from the API --- include/core/state_block/state_composite.h | 2 -- src/state_block/state_composite.cpp | 12 ------------ test/gtest_state_composite.cpp | 14 -------------- 3 files changed, 28 deletions(-) diff --git a/include/core/state_block/state_composite.h b/include/core/state_block/state_composite.h index 44fdc98d5..0d3cafcc8 100644 --- a/include/core/state_block/state_composite.h +++ b/include/core/state_block/state_composite.h @@ -49,8 +49,6 @@ class VectorComposite : public std::unordered_map < std::string, Eigen::VectorXd VectorComposite(const VectorXd& _v, const StateStructure& _structure, const std::list<int>& _sizes); VectorComposite(const StateStructure& _structure, const std::list<VectorXd>& _vectors); - unsigned int size(const StateStructure& _structure) const; - Eigen::VectorXd vector(const StateStructure& _structure) const; /** diff --git a/src/state_block/state_composite.cpp b/src/state_block/state_composite.cpp index 612b8e53e..90b7f47c6 100644 --- a/src/state_block/state_composite.cpp +++ b/src/state_block/state_composite.cpp @@ -62,18 +62,6 @@ VectorComposite::VectorComposite (const StateStructure& _structure, const std::l } -unsigned int VectorComposite::size(const StateStructure &_structure) const -{ - unsigned int size = 0; - for (const auto& ckey : _structure) - { - std::string key(1,ckey); // ckey is char - const VectorXd& v = this->at(key); - size += v.size(); - } - return size; -} - Eigen::VectorXd VectorComposite::vector(const StateStructure &_structure) const { // traverse once with unordered_map access diff --git a/test/gtest_state_composite.cpp b/test/gtest_state_composite.cpp index 4d5a42011..56f705aa3 100644 --- a/test/gtest_state_composite.cpp +++ b/test/gtest_state_composite.cpp @@ -331,20 +331,6 @@ TEST(VectorComposite, unary_Minus) ASSERT_MATRIX_APPROX((-x).at("O"), Vector3d(-2,-2,-2), 1e-20); } -TEST(VectorComposite, size) -{ - VectorComposite x; - - x.emplace("P", Vector2d(1,1)); - x.emplace("O", Vector3d(2,2,2)); - x.emplace("V", Vector4d(3,3,3,3)); - - ASSERT_EQ(x.size("PO"), 5); - ASSERT_EQ(x.size("VO"), 7); - ASSERT_EQ(x.size("PVO"), 9); - ASSERT_EQ(x.size("OPV"), 9); -} - TEST(VectorComposite, stateVector) { VectorComposite x; -- GitLab