From 384b2078e4962d762db4293bf3396be17df4e5c7 Mon Sep 17 00:00:00 2001 From: Olivier Stasse <ostasse@laas.fr> Date: Mon, 26 Aug 2019 17:24:57 +0200 Subject: [PATCH] [clang] Update format. --- include/dynamic-graph/logger.h | 12 ++++++------ tests/debug-logger.cpp | 14 ++++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/include/dynamic-graph/logger.h b/include/dynamic-graph/logger.h index 884c943..2f018f7 100644 --- a/include/dynamic-graph/logger.h +++ b/include/dynamic-graph/logger.h @@ -61,14 +61,14 @@ namespace dynamicgraph { #define SEND_WARNING_STREAM_MSG(msg) SEND_MSG(msg, MSG_TYPE_WARNING_STREAM) #define SEND_ERROR_STREAM_MSG(msg) SEND_MSG(msg, MSG_TYPE_ERROR_STREAM) -template<typename T> -std::string toString(const T& v, const int precision=3, const int width=-1) -{ +template <typename T> +std::string toString(const T &v, const int precision = 3, + const int width = -1) { std::stringstream ss; - if(width>precision) - ss<<std::fixed<<std::setw(width)<<std::setprecision(precision)<<v; + if (width > precision) + ss << std::fixed << std::setw(width) << std::setprecision(precision) << v; else - ss<<std::fixed<<std::setprecision(precision)<<v; + ss << std::fixed << std::setprecision(precision) << v; return ss.str(); } diff --git a/tests/debug-logger.cpp b/tests/debug-logger.cpp index db15ee0..4357c1f 100644 --- a/tests/debug-logger.cpp +++ b/tests/debug-logger.cpp @@ -51,15 +51,17 @@ public: sendMsg("This is a message of level MSG_TYPE_ERROR_STREAM", MSG_TYPE_ERROR_STREAM); /* Add test toString */ - double q=1.0; - sendMsg("Value to display: "+toString(q)); + double q = 1.0; + sendMsg("Value to display: " + toString(q)); std::vector<double> vq; vq.resize(3); - vq[0] = 1.0; vq[1] = 2.0; vq[2] = 3.0; - sendMsg("Value to display: "+toString(vq)); - Eigen::Matrix<double,3,3> an_eig_m; + vq[0] = 1.0; + vq[1] = 2.0; + vq[2] = 3.0; + sendMsg("Value to display: " + toString(vq)); + Eigen::Matrix<double, 3, 3> an_eig_m; an_eig_m.Ones(); - sendMsg("Value to display: "+toString(an_eig_m)); + sendMsg("Value to display: " + toString(an_eig_m)); logger_.countdown(); } }; -- GitLab