Skip to content
Snippets Groups Projects
Commit 60916617 authored by Joaquim Casals Buñuel's avatar Joaquim Casals Buñuel
Browse files

Split check_log.hpp -> {.h, .cpp}

parent 89f00c17
No related branches found
No related tags found
No related merge requests found
Pipeline #5099 passed
......@@ -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
......
#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
#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
......@@ -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
......
#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);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment