From 1a10c440bb174259407162e6b735946cbcc4bae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu> Date: Fri, 23 Aug 2019 16:25:17 +0200 Subject: [PATCH] Make print() const --- hello_wolf/processor_range_bearing.h | 2 +- hello_wolf/sensor_range_bearing.h | 2 +- include/core/common/params_base.h | 2 +- include/core/processor/processor_base.h | 4 ++-- include/core/processor/processor_diff_drive.h | 2 +- include/core/processor/processor_motion.h | 2 +- include/core/processor/processor_odom_2D.h | 2 +- include/core/processor/processor_odom_3D.h | 2 +- include/core/processor/processor_tracker.h | 4 ++-- include/core/sensor/sensor_base.h | 2 +- include/core/sensor/sensor_diff_drive.h | 1 + include/core/sensor/sensor_odom_2D.h | 2 +- include/core/sensor/sensor_odom_3D.h | 2 +- src/processor/processor_base.cpp | 2 +- 14 files changed, 16 insertions(+), 15 deletions(-) diff --git a/hello_wolf/processor_range_bearing.h b/hello_wolf/processor_range_bearing.h index 527efd1f6..65e87f56e 100644 --- a/hello_wolf/processor_range_bearing.h +++ b/hello_wolf/processor_range_bearing.h @@ -31,7 +31,7 @@ struct ProcessorParamsRangeBearing : public ProcessorParamsBase { // } - std::string print() + std::string print() const { return "\n" + ProcessorParamsBase::print(); } diff --git a/hello_wolf/sensor_range_bearing.h b/hello_wolf/sensor_range_bearing.h index b7788c27f..2e9bcf214 100644 --- a/hello_wolf/sensor_range_bearing.h +++ b/hello_wolf/sensor_range_bearing.h @@ -29,7 +29,7 @@ struct IntrinsicsRangeBearing : public IntrinsicsBase noise_range_metres_std = _server.getParam<Scalar>(_unique_name + "/noise_range_metres_std"); noise_bearing_degrees_std = _server.getParam<Scalar>(_unique_name + "/noise_bearing_degrees_std"); } - std::string print() + std::string print() const { return "" + IntrinsicsBase::print() + "\n" + "noise_range_metres_std: " + std::to_string(noise_range_metres_std) + "\n" diff --git a/include/core/common/params_base.h b/include/core/common/params_base.h index 767ece49d..5295bc0ac 100644 --- a/include/core/common/params_base.h +++ b/include/core/common/params_base.h @@ -13,7 +13,7 @@ namespace wolf { } virtual ~ParamsBase() = default; - std::string print() + std::string print() const { return ""; } diff --git a/include/core/processor/processor_base.h b/include/core/processor/processor_base.h index 1eee919de..d57846275 100644 --- a/include/core/processor/processor_base.h +++ b/include/core/processor/processor_base.h @@ -180,7 +180,7 @@ class BufferPackKeyFrame : public Buffer<PackKeyFramePtr> /**\brief Print buffer information * */ - void print(); + void print() const; /**\brief Alias funct * @@ -224,7 +224,7 @@ struct ProcessorParamsBase : public ParamsBase bool voting_aux_active = false; ///< Whether this processor is allowed to vote for an Auxiliary Frame or not - std::string print() + std::string print() const { return ParamsBase::print() + "\n" + "voting_active: " + std::to_string(voting_active) + "\n" diff --git a/include/core/processor/processor_diff_drive.h b/include/core/processor/processor_diff_drive.h index d4aa5a792..1192230af 100644 --- a/include/core/processor/processor_diff_drive.h +++ b/include/core/processor/processor_diff_drive.h @@ -22,7 +22,7 @@ struct ProcessorParamsDiffDrive : public ProcessorParamsOdom2D ProcessorParamsOdom2D(_unique_name, _server) { } - std::string print() + std::string print() const { return "\n" + ProcessorParamsOdom2D::print(); } diff --git a/include/core/processor/processor_motion.h b/include/core/processor/processor_motion.h index 1cd51d36e..41fc77be5 100644 --- a/include/core/processor/processor_motion.h +++ b/include/core/processor/processor_motion.h @@ -40,7 +40,7 @@ struct ProcessorParamsMotion : public ProcessorParamsBase angle_turned = _server.getParam<Scalar>(_unique_name + "/keyframe_vote/angle_turned"); unmeasured_perturbation_std = _server.getParam<Scalar>(_unique_name + "/unmeasured_perturbation_std"); } - std::string print() + std::string print() const { return "\n" + ProcessorParamsBase::print() + "\n" + "max_time_span: " + std::to_string(max_time_span) + "\n" diff --git a/include/core/processor/processor_odom_2D.h b/include/core/processor/processor_odom_2D.h index 8fca11b3e..2957ec7de 100644 --- a/include/core/processor/processor_odom_2D.h +++ b/include/core/processor/processor_odom_2D.h @@ -30,7 +30,7 @@ struct ProcessorParamsOdom2D : public ProcessorParamsMotion cov_det = _server.getParam<Scalar>(_unique_name + "/keyframe_vote/cov_det"); } - std::string print() + std::string print() const { return "\n" + ProcessorParamsMotion::print() + "\n" + "cov_det: " + std::to_string(cov_det) + "\n"; diff --git a/include/core/processor/processor_odom_3D.h b/include/core/processor/processor_odom_3D.h index bd1e3cf01..1512b996e 100644 --- a/include/core/processor/processor_odom_3D.h +++ b/include/core/processor/processor_odom_3D.h @@ -27,7 +27,7 @@ struct ProcessorParamsOdom3D : public ProcessorParamsMotion { // } - std::string print() + std::string print() const { return "\n" + ProcessorParamsMotion::print(); } diff --git a/include/core/processor/processor_tracker.h b/include/core/processor/processor_tracker.h index dc59acee3..a1e645186 100644 --- a/include/core/processor/processor_tracker.h +++ b/include/core/processor/processor_tracker.h @@ -27,7 +27,7 @@ struct ProcessorParamsTracker : public ProcessorParamsBase min_features_for_keyframe = _server.getParam<unsigned int>(_unique_name + "/min_features_for_keyframe"); max_new_features = _server.getParam<int>(_unique_name + "/max_new_features"); } - std::string print() + std::string print() const { return ProcessorParamsBase::print() + "\n" + "min_features_for_keyframe: " + std::to_string(min_features_for_keyframe) + "\n" @@ -230,7 +230,7 @@ class ProcessorTracker : public ProcessorBase FeatureBasePtrList& getNewFeaturesListLast(); - std::string print(){ + std::string print() const { return this->params_tracker_->print(); } diff --git a/include/core/sensor/sensor_base.h b/include/core/sensor/sensor_base.h index e9945a9b4..67e0c032d 100644 --- a/include/core/sensor/sensor_base.h +++ b/include/core/sensor/sensor_base.h @@ -74,7 +74,7 @@ struct IntrinsicsBase: public ParamsBase { virtual ~IntrinsicsBase() = default; using ParamsBase::ParamsBase; - std::string print() + std::string print() const { return ""; } diff --git a/include/core/sensor/sensor_diff_drive.h b/include/core/sensor/sensor_diff_drive.h index a36356ed8..79d1c769a 100644 --- a/include/core/sensor/sensor_diff_drive.h +++ b/include/core/sensor/sensor_diff_drive.h @@ -36,6 +36,7 @@ struct IntrinsicsDiffDrive : public IntrinsicsBase radians_per_tick = 2.0 * M_PI / ticks_per_wheel_revolution; } std::string print() + std::string print() const { return "\n" + IntrinsicsBase::print() + "\n" + "radius_left: " + std::to_string(radius_left) + "\n" diff --git a/include/core/sensor/sensor_odom_2D.h b/include/core/sensor/sensor_odom_2D.h index 83b776add..463a9c3d9 100644 --- a/include/core/sensor/sensor_odom_2D.h +++ b/include/core/sensor/sensor_odom_2D.h @@ -25,7 +25,7 @@ struct IntrinsicsOdom2D : public IntrinsicsBase k_disp_to_disp = _server.getParam<Scalar>(_unique_name + "/k_disp_to_disp"); k_rot_to_rot = _server.getParam<Scalar>(_unique_name + "/k_rot_to_rot"); } - std::string print() + std::string print() const { return "\n" + IntrinsicsBase::print() + "\n" + "k_disp_to_disp: " + std::to_string(k_disp_to_disp) + "\n" diff --git a/include/core/sensor/sensor_odom_3D.h b/include/core/sensor/sensor_odom_3D.h index 1a727d613..3e141b939 100644 --- a/include/core/sensor/sensor_odom_3D.h +++ b/include/core/sensor/sensor_odom_3D.h @@ -36,7 +36,7 @@ struct IntrinsicsOdom3D : public IntrinsicsBase min_disp_var = _server.getParam<Scalar>(_unique_name + "/min_disp_var"); min_rot_var = _server.getParam<Scalar>(_unique_name + "/min_rot_var"); } - std::string print() + std::string print() const { return "\n" + IntrinsicsBase::print() + "\n" + "k_disp_to_disp: " + std::to_string(k_disp_to_disp) + "\n" diff --git a/src/processor/processor_base.cpp b/src/processor/processor_base.cpp index 1e8b098df..c89ece40f 100644 --- a/src/processor/processor_base.cpp +++ b/src/processor/processor_base.cpp @@ -181,7 +181,7 @@ PackKeyFramePtr BufferPackKeyFrame::selectFirstPackBefore(const CaptureBasePtr _ return selectFirstPackBefore(_capture->getTimeStamp(), _time_tolerance); } -void BufferPackKeyFrame::print(void) +void BufferPackKeyFrame::print(void) const { std::cout << "[ "; for (auto iter : container_) -- GitLab