From 915b2698af6d7c67651295c014b67b238ac18e33 Mon Sep 17 00:00:00 2001 From: jvallve <jvallve@iri.upc.edu> Date: Mon, 26 Jun 2017 13:01:48 +0200 Subject: [PATCH] removed typedef of string --- src/problem.cpp | 4 ++-- src/problem.h | 4 ++-- src/trajectory_base.cpp | 2 +- src/trajectory_base.h | 8 ++++---- src/wolf.h | 2 -- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/problem.cpp b/src/problem.cpp index 191cffb50..9305ae083 100644 --- a/src/problem.cpp +++ b/src/problem.cpp @@ -27,7 +27,7 @@ std::string uppercase(std::string s) {for (auto & c: s) c = std::toupper(c); ret } -Problem::Problem(FrameStructure _frame_structure) : +Problem::Problem(const std::string& _frame_structure) : hardware_ptr_(std::make_shared<HardwareBase>()), trajectory_ptr_(std::make_shared<TrajectoryBase>(_frame_structure)), map_ptr_(std::make_shared<MapBase>()), @@ -44,7 +44,7 @@ void Problem::setup() map_ptr_->setProblem(shared_from_this()); } -ProblemPtr Problem::create(FrameStructure _frame_structure) +ProblemPtr Problem::create(const std::string& _frame_structure) { ProblemPtr p(new Problem(_frame_structure)); // We use `new` and not `make_shared` since the Problem constructor is private and cannot be passes to `make_shared`. p->setup(); diff --git a/src/problem.h b/src/problem.h index d12f0c33b..900c719f9 100644 --- a/src/problem.h +++ b/src/problem.h @@ -59,11 +59,11 @@ class Problem : public std::enable_shared_from_this<Problem> bool origin_is_set_; private: // CAUTION: THESE METHODS ARE PRIVATE, DO NOT MAKE THEM PUBLIC !! - Problem(FrameStructure _frame_structure); // USE create() below !! + Problem(const std::string& _frame_structure); // USE create() below !! void setup(); public: - static ProblemPtr create(FrameStructure _frame_structure); // USE THIS AS A CONSTRUCTOR! + static ProblemPtr create(const std::string& _frame_structure); // USE THIS AS A CONSTRUCTOR! virtual ~Problem(); // Properties ----------------------------------------- diff --git a/src/trajectory_base.cpp b/src/trajectory_base.cpp index 4f184aa88..afade396a 100644 --- a/src/trajectory_base.cpp +++ b/src/trajectory_base.cpp @@ -4,7 +4,7 @@ namespace wolf { -TrajectoryBase::TrajectoryBase(FrameStructure _frame_structure) : +TrajectoryBase::TrajectoryBase(const std::string& _frame_structure) : NodeBase("TRAJECTORY"), frame_structure_(_frame_structure), last_key_frame_ptr_(nullptr) diff --git a/src/trajectory_base.h b/src/trajectory_base.h index 5f7c17bb7..18c63e39e 100644 --- a/src/trajectory_base.h +++ b/src/trajectory_base.h @@ -24,15 +24,15 @@ class TrajectoryBase : public NodeBase, public std::enable_shared_from_this<Traj std::list<FrameBasePtr> frame_list_; protected: - FrameStructure frame_structure_; // Defines the structure of the Frames in the Trajectory. + std::string frame_structure_; // Defines the structure of the Frames in the Trajectory. FrameBasePtr last_key_frame_ptr_; // keeps pointer to the last key frame public: - TrajectoryBase(FrameStructure _frame_sturcture); + TrajectoryBase(const std::string& _frame_sturcture); virtual ~TrajectoryBase(); // Properties - FrameStructure getFrameStructure() const; + std::string getFrameStructure() const; // Frames FrameBasePtr addFrame(FrameBasePtr _frame_ptr); @@ -83,7 +83,7 @@ inline void TrajectoryBase::setLastKeyFramePtr(FrameBasePtr _key_frame_ptr) } -inline FrameStructure TrajectoryBase::getFrameStructure() const +inline std::string TrajectoryBase::getFrameStructure() const { return frame_structure_; } diff --git a/src/wolf.h b/src/wolf.h index 4105c101c..490ce112f 100644 --- a/src/wolf.h +++ b/src/wolf.h @@ -189,8 +189,6 @@ typedef enum KEY_FRAME = 1 ///< key frame. It will stay in the frames window and play at optimizations. } FrameType; -typedef std::string FrameStructure; - /** \brief Enumeration of all possible constraints * * You may add items to this list as needed. Be concise with names, and document your entries. -- GitLab