From 7ec4574e3c88b30ccf1b782b59ca20e2df2dd507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu> Date: Sat, 19 Dec 2020 17:04:24 +0100 Subject: [PATCH] rename Frm::emplaceFrame --> emplace --- include/core/frame/frame_base.h | 4 ++-- src/problem/problem.cpp | 30 ++++++++++++++--------------- src/processor/processor_motion.cpp | 8 ++++---- src/processor/processor_tracker.cpp | 8 ++++---- test/gtest_emplace.cpp | 12 ++++++------ test/gtest_factor_diff_drive.cpp | 4 ++-- test/gtest_frame_base.cpp | 4 ++-- 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/include/core/frame/frame_base.h b/include/core/frame/frame_base.h index baf67a4ae..c4e423947 100644 --- a/include/core/frame/frame_base.h +++ b/include/core/frame/frame_base.h @@ -65,7 +65,7 @@ class FrameBase : public NodeBase, public HasStateBlocks, public std::enable_sha // Add and remove from WOLF tree --------------------------------- template<typename classType, typename... T> - static std::shared_ptr<classType> emplaceFrame(TrajectoryBasePtr _ptr, T&&... all); + static std::shared_ptr<classType> emplace(TrajectoryBasePtr _ptr, T&&... all); void link(TrajectoryBasePtr); void link(ProblemPtr _prb); @@ -157,7 +157,7 @@ class FrameBase : public NodeBase, public HasStateBlocks, public std::enable_sha namespace wolf { template<typename classType, typename... T> -std::shared_ptr<classType> FrameBase::emplaceFrame(TrajectoryBasePtr _ptr, T&&... all) +std::shared_ptr<classType> FrameBase::emplace(TrajectoryBasePtr _ptr, T&&... all) { std::shared_ptr<classType> frm = std::make_shared<classType>(std::forward<T>(all)...); frm->link(_ptr); diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp index d0a311aec..3dceffdd7 100644 --- a/src/problem/problem.cpp +++ b/src/problem/problem.cpp @@ -356,10 +356,10 @@ FrameBasePtr Problem::emplaceFrame(const TimeStamp& _time_stamp, // assert (_frame_state.size() == index && "State vector incompatible with given structure and dimension! Vector too large."); - auto frm = FrameBase::emplaceFrame<FrameBase>(trajectory_ptr_, - _time_stamp, - _frame_structure, - state); + auto frm = FrameBase::emplace<FrameBase>(trajectory_ptr_, + _time_stamp, + _frame_structure, + state); return frm; } @@ -377,10 +377,10 @@ FrameBasePtr Problem::emplaceFrame (const TimeStamp& _time_stamp, // const StateStructure& _frame_structure, // const VectorComposite& _frame_state) { - return FrameBase::emplaceFrame<FrameBase>(getTrajectory(), - _time_stamp, - _frame_structure, - _frame_state); + return FrameBase::emplace<FrameBase>(getTrajectory(), + _time_stamp, + _frame_structure, + _frame_state); } FrameBasePtr Problem::emplaceFrame (const TimeStamp& _time_stamp, // @@ -394,14 +394,14 @@ FrameBasePtr Problem::emplaceFrame (const TimeStamp& _time_stamp, // frame_structure_ += std::string(1,key); } - return FrameBase::emplaceFrame<FrameBase>(getTrajectory(), - _time_stamp, - getFrameStructure(), - _frame_state); + return FrameBase::emplace<FrameBase>(getTrajectory(), + _time_stamp, + getFrameStructure(), + _frame_state); } FrameBasePtr Problem::emplaceFrame(const TimeStamp& _time_stamp, // - const Eigen::VectorXd& _frame_state) + const Eigen::VectorXd& _frame_state) { return emplaceFrame(_time_stamp, this->getFrameStructure(), @@ -412,8 +412,8 @@ FrameBasePtr Problem::emplaceFrame(const TimeStamp& _time_stamp, // FrameBasePtr Problem::emplaceFrame(const TimeStamp& _time_stamp) { return emplaceFrame(_time_stamp, - this->getFrameStructure(), - this->getDim()); + this->getFrameStructure(), + this->getDim()); } TimeStamp Problem::getTimeStamp ( ) const diff --git a/src/processor/processor_motion.cpp b/src/processor/processor_motion.cpp index 17919a7b9..c6fda0b64 100644 --- a/src/processor/processor_motion.cpp +++ b/src/processor/processor_motion.cpp @@ -662,10 +662,10 @@ VectorComposite ProcessorMotion::getState(const TimeStamp& _ts, const StateStruc FrameBasePtr ProcessorMotion::setOrigin(const VectorComposite& _x_origin, const TimeStamp& _ts_origin) { - FrameBasePtr key_frame_ptr = FrameBase::emplaceFrame<FrameBase>(getProblem()->getTrajectory(), - _ts_origin, - getStateStructure(), - _x_origin); + FrameBasePtr key_frame_ptr = FrameBase::emplace<FrameBase>(getProblem()->getTrajectory(), + _ts_origin, + getStateStructure(), + _x_origin); setOrigin(key_frame_ptr); return key_frame_ptr; diff --git a/src/processor/processor_tracker.cpp b/src/processor/processor_tracker.cpp index 860b9867f..52421e863 100644 --- a/src/processor/processor_tracker.cpp +++ b/src/processor/processor_tracker.cpp @@ -81,10 +81,10 @@ void ProcessorTracker::processCapture(CaptureBasePtr _incoming_ptr) { WOLF_DEBUG( "PT ", getName(), " FIRST_TIME_WITHOUT_PACK" ); - FrameBasePtr kfrm = FrameBase::emplaceFrame<FrameBase>(getProblem()->getTrajectory(), - incoming_ptr_->getTimeStamp(), - getProblem()->getFrameStructure(), - getProblem()->getState()); + FrameBasePtr kfrm = FrameBase::emplace<FrameBase>(getProblem()->getTrajectory(), + incoming_ptr_->getTimeStamp(), + getProblem()->getFrameStructure(), + getProblem()->getState()); incoming_ptr_->link(kfrm); // Process info diff --git a/test/gtest_emplace.cpp b/test/gtest_emplace.cpp index 23d0e0970..21ed31670 100644 --- a/test/gtest_emplace.cpp +++ b/test/gtest_emplace.cpp @@ -42,7 +42,7 @@ TEST(Emplace, Frame) ProblemPtr P = Problem::create("POV", 3); ASSERT_NE(P->getTrajectory(), nullptr); - FrameBase::emplaceFrame<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); + FrameBase::emplace<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); ASSERT_EQ(P, P->getTrajectory()->getFirstFrame()->getTrajectory()->getProblem()); } @@ -67,7 +67,7 @@ TEST(Emplace, Capture) ProblemPtr P = Problem::create("POV", 3); ASSERT_NE(P->getTrajectory(), nullptr); - auto frm = FrameBase::emplaceFrame<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); + auto frm = FrameBase::emplace<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); ASSERT_EQ(P, P->getTrajectory()->getFirstFrame()->getTrajectory()->getProblem()); auto cpt = CaptureBase::emplace<CaptureBase>(frm, "Dummy", TimeStamp(0), nullptr, nullptr, nullptr, nullptr); @@ -81,7 +81,7 @@ TEST(Emplace, Feature) ProblemPtr P = Problem::create("POV", 3); ASSERT_NE(P->getTrajectory(), nullptr); - auto frm = FrameBase::emplaceFrame<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); + auto frm = FrameBase::emplace<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); ASSERT_EQ(P, P->getTrajectory()->getFirstFrame()->getTrajectory()->getProblem()); auto cpt = CaptureBase::emplace<CaptureBase>(frm, "Dummy", TimeStamp(0), nullptr, nullptr, nullptr, nullptr); @@ -99,7 +99,7 @@ TEST(Emplace, Factor) ProblemPtr P = Problem::create("POV", 3); ASSERT_NE(P->getTrajectory(), nullptr); - auto frm = FrameBase::emplaceFrame<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); + auto frm = FrameBase::emplace<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); ASSERT_EQ(P, P->getTrajectory()->getFirstFrame()->getTrajectory()->getProblem()); auto cpt = CaptureBase::emplace<CaptureBase>(frm, "Dummy", TimeStamp(0), nullptr, nullptr, nullptr, nullptr); @@ -119,7 +119,7 @@ TEST(Emplace, EmplaceDerived) { ProblemPtr P = Problem::create("POV", 3); - auto frm = FrameBase::emplaceFrame<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); + auto frm = FrameBase::emplace<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); auto sen = SensorBase::emplace<SensorOdom2d>(P->getHardware(), Eigen::VectorXd(3), ParamsSensorOdom2d()); auto cov = Eigen::MatrixXd::Identity(2,2); auto cpt = CaptureBase::emplace<CaptureOdom2d>(frm, TimeStamp(0), sen, Eigen::VectorXd(2), cov, nullptr); @@ -141,7 +141,7 @@ TEST(Emplace, ReturnDerived) ProblemPtr P = Problem::create("POV", 3); ASSERT_NE(P->getTrajectory(), nullptr); - auto frm = FrameBase::emplaceFrame<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); + auto frm = FrameBase::emplace<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); auto cpt = CaptureBase::emplace<CaptureBase>(frm, "Dummy", TimeStamp(0), nullptr, nullptr, nullptr, nullptr); auto cov = Eigen::MatrixXd::Identity(2,2); auto ftr = FeatureBase::emplace<FeatureOdom2d>(cpt, Eigen::VectorXd(2), cov); diff --git a/test/gtest_factor_diff_drive.cpp b/test/gtest_factor_diff_drive.cpp index 61f38c020..4f3ece70d 100644 --- a/test/gtest_factor_diff_drive.cpp +++ b/test/gtest_factor_diff_drive.cpp @@ -159,11 +159,11 @@ class FactorDiffDriveTest : public testing::Test processor = std::static_pointer_cast<ProcessorDiffDrivePublic>(prc); // frames - F0 = FrameBase::emplaceFrame<FrameBase>(trajectory, + F0 = FrameBase::emplace<FrameBase>(trajectory, 0.0, "PO", std::list<VectorXd>{Vector2d(0,0), Vector1d(0)}); - F1 = FrameBase::emplaceFrame<FrameBase>(trajectory, + F1 = FrameBase::emplace<FrameBase>(trajectory, 1.0, "PO", std::list<VectorXd>{Vector2d(1,0), Vector1d(0)}); diff --git a/test/gtest_frame_base.cpp b/test/gtest_frame_base.cpp index 8b651ae32..ac405e6fa 100644 --- a/test/gtest_frame_base.cpp +++ b/test/gtest_frame_base.cpp @@ -65,8 +65,8 @@ TEST(FrameBase, LinksToTree) intrinsics_odo.k_disp_to_disp = 1; intrinsics_odo.k_rot_to_rot = 1; auto S = SensorBase::emplace<SensorOdom2d>(P->getHardware(), Vector3d::Zero(), intrinsics_odo); - auto F1 = FrameBase::emplaceFrame<FrameBase>(T, 1, make_shared<StateBlock>(2), make_shared<StateBlock>(1)); - auto F2 = FrameBase::emplaceFrame<FrameBase>(T, 2, make_shared<StateBlock>(2), make_shared<StateBlock>(1)); + auto F1 = FrameBase::emplace<FrameBase>(T, 1, make_shared<StateBlock>(2), make_shared<StateBlock>(1)); + auto F2 = FrameBase::emplace<FrameBase>(T, 2, make_shared<StateBlock>(2), make_shared<StateBlock>(1)); auto C = CaptureBase::emplace<CaptureMotion>(F1, "CaptureMotion", 1, S, Vector3d::Zero(), nullptr); WOLF_INFO("F2->getCaptureList().size() ", F2->getCaptureList().size()); auto p = std::make_shared<ProcessorOdom2d>(std::make_shared<ParamsProcessorOdom2d>()); -- GitLab