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

Refactor CheckLog @ Problem::check

parent ac2d3652
No related branches found
No related tags found
1 merge request!346Resolve "Frame/Capture/Feature/Landmark Other as list/vectors in FactorBase"
Pipeline #5057 passed
...@@ -2,31 +2,42 @@ ...@@ -2,31 +2,42 @@
#define CHECK_LOG_HPP #define CHECK_LOG_HPP
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <sstream>
class CheckLog { namespace wolf
{
class CheckLog
{
public:
bool is_consistent_;
std::string explanation_;
public: CheckLog()
{
bool is_consistent_; is_consistent_ = true;
std::string explanation_; explanation_ = "";
}
CheckLog() { CheckLog(bool consistent, std::string explanation)
is_consistent_ = true; {
explanation_ = ""; is_consistent_ = consistent;
} if (not consistent)
CheckLog(bool consistent, std::string explanation) { explanation_ = explanation;
is_consistent_ = consistent; else
if (not consistent) explanation_ = "";
explanation_ = explanation; }
else ~CheckLog(){};
explanation_ = ""; void compose(CheckLog l)
} {
~CheckLog(){}; is_consistent_ = is_consistent_ and l.is_consistent_;
void compose(CheckLog l) { explanation_ = explanation_ + l.explanation_;
}
CheckLog result_log; void addAssertion(bool condition, std::stringstream& stream)
is_consistent_ = is_consistent_ and l.is_consistent_; {
explanation_ = explanation_ + l.explanation_; auto cl = CheckLog(condition, stream.str());
} this->compose(cl);
// Clear inconsistency_explanation
std::stringstream().swap(stream);
}
}; };
} // namespace wolf
#endif #endif
This diff is collapsed.
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