From 60916617bda756e4e7c474a24e06baae60fcaf11 Mon Sep 17 00:00:00 2001 From: jcasals <jcasals@iri.upc.edu> Date: Fri, 3 Apr 2020 11:59:36 +0200 Subject: [PATCH] Split check_log.hpp -> {.h, .cpp} --- CMakeLists.txt | 3 ++- include/core/utils/check_log.h | 22 ++++++++++++++++ include/core/utils/check_log.hpp | 43 -------------------------------- src/problem/problem.cpp | 2 +- src/utils/check_log.cpp | 29 +++++++++++++++++++++ 5 files changed, 54 insertions(+), 45 deletions(-) create mode 100644 include/core/utils/check_log.h delete mode 100644 include/core/utils/check_log.hpp create mode 100644 src/utils/check_log.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dafd62f1..cab800a23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,7 +181,7 @@ SET(HDRS_MATH include/core/math/covariance.h ) SET(HDRS_UTILS - include/core/utils/check_log.hpp + include/core/utils/check_log.h include/core/utils/converter.h include/core/utils/eigen_assert.h include/core/utils/eigen_predicates.h @@ -323,6 +323,7 @@ SET(SRCS_UTILS src/utils/converter_utils.cpp src/utils/params_server.cpp src/utils/loader.cpp + src/utils/check_log.cpp ) SET(SRCS_CAPTURE diff --git a/include/core/utils/check_log.h b/include/core/utils/check_log.h new file mode 100644 index 000000000..035bd0aa0 --- /dev/null +++ b/include/core/utils/check_log.h @@ -0,0 +1,22 @@ +#ifndef CHECK_LOG_H +#define CHECK_LOG_H +#include <iostream> +#include <string> +#include <sstream> + +namespace wolf +{ +class CheckLog +{ + public: + bool is_consistent_; + std::string explanation_; + + CheckLog(); + CheckLog(bool _consistent, std::string _explanation); + ~CheckLog(){}; + void compose(CheckLog l); + void assertTrue(bool _condition, std::stringstream& _stream); +}; +} // namespace wolf +#endif diff --git a/include/core/utils/check_log.hpp b/include/core/utils/check_log.hpp deleted file mode 100644 index 844b4d8ea..000000000 --- a/include/core/utils/check_log.hpp +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef CHECK_LOG_HPP -#define CHECK_LOG_HPP -#include <iostream> -#include <string> -#include <sstream> - -namespace wolf -{ -class CheckLog -{ - public: - bool is_consistent_; - std::string explanation_; - - CheckLog() - { - is_consistent_ = true; - explanation_ = ""; - } - CheckLog(bool _consistent, std::string _explanation) - { - is_consistent_ = _consistent; - if (not _consistent) - explanation_ = _explanation; - else - explanation_ = ""; - } - ~CheckLog(){}; - void compose(CheckLog l) - { - is_consistent_ = is_consistent_ and l.is_consistent_; - explanation_ = explanation_ + l.explanation_; - } - void assertTrue(bool _condition, std::stringstream& _stream) - { - auto cl = CheckLog(_condition, _stream.str()); - this->compose(cl); - // Clear inconsistency_explanation - std::stringstream().swap(_stream); - } -}; -} // namespace wolf -#endif diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp index 1d72f5b8f..53acc960e 100644 --- a/src/problem/problem.cpp +++ b/src/problem/problem.cpp @@ -14,7 +14,7 @@ #include "core/utils/logging.h" #include "core/utils/params_server.h" #include "core/utils/loader.h" -#include "core/utils/check_log.hpp" +#include "core/utils/check_log.h" // IRI libs includes diff --git a/src/utils/check_log.cpp b/src/utils/check_log.cpp new file mode 100644 index 000000000..06e58733a --- /dev/null +++ b/src/utils/check_log.cpp @@ -0,0 +1,29 @@ +#include "core/utils/check_log.h" + +using namespace wolf; + +CheckLog::CheckLog() +{ + is_consistent_ = true; + explanation_ = ""; +} +CheckLog::CheckLog(bool _consistent, std::string _explanation) +{ + is_consistent_ = _consistent; + if (not _consistent) + explanation_ = _explanation; + else + explanation_ = ""; +} +void CheckLog::compose(CheckLog l) +{ + is_consistent_ = is_consistent_ and l.is_consistent_; + explanation_ = explanation_ + l.explanation_; +} +void CheckLog::assertTrue(bool _condition, std::stringstream& _stream) +{ + auto cl = CheckLog(_condition, _stream.str()); + this->compose(cl); + // Clear inconsistency_explanation + std::stringstream().swap(_stream); +} -- GitLab