style: Core 全局格式化

This commit is contained in:
MistEO
2023-04-27 23:15:03 +08:00
parent b231fffd54
commit 5d11efa4e4
18 changed files with 62 additions and 76 deletions

View File

@@ -481,7 +481,6 @@ void asst::Assistant::call_proc()
LogTraceFunction;
while (!m_thread_exit) {
AsyncCallItem call_item;
{

View File

@@ -98,7 +98,6 @@ void asst::InfrastProductionTask::change_product()
break;
}
case infrast::CustomRoomConfig::Product::Dualchip: {
break;
}
/*贸易站的订单类型*/

View File

@@ -6,9 +6,9 @@
#include "Controller/Controller.h"
#include "Task/ProcessTask.h"
#include "Utils/Logger.hpp"
#include "Vision/MultiMatchImageAnalyzer.h"
#include "Vision/Infrast/InfrastClueVacancyImageAnalyzer.h"
#include "Vision/MatchImageAnalyzer.h"
#include "Vision/MultiMatchImageAnalyzer.h"
bool asst::InfrastReceptionTask::_run()
{

View File

@@ -9,16 +9,17 @@ namespace asst::utils
concept ByteValueType = std::is_integral_v<ValueType> && sizeof(ValueType) == 1;
template <typename ContainerType>
concept AppendableBytesContainer = requires(ContainerType a) {
requires ranges::contiguous_range<ContainerType>;
requires ByteValueType<typename ContainerType::value_type>;
requires std::is_constructible_v<ContainerType>;
requires std::is_constructible_v<ContainerType, size_t,
typename ContainerType::value_type>; // std::string(count, ch),
// std::vector(count, value)
a.insert(a.end(), a.begin(), a.begin() + (size_t)1);
a.resize(a.size());
};
concept AppendableBytesContainer =
requires(ContainerType a) {
requires ranges::contiguous_range<ContainerType>;
requires ByteValueType<typename ContainerType::value_type>;
requires std::is_constructible_v<ContainerType>;
requires std::is_constructible_v<ContainerType, size_t,
typename ContainerType::value_type>; // std::string(count, ch),
// std::vector(count, value)
a.insert(a.end(), a.begin(), a.begin() + (size_t)1);
a.resize(a.size());
};
template <AppendableBytesContainer ContainerType>
ContainerType read_file(const std::filesystem::path& path)

View File

@@ -91,4 +91,3 @@ bool AbstractImageAnalyzer::save_img(const std::filesystem::path& relative_dir)
return ret;
}

View File

@@ -109,5 +109,4 @@ namespace asst
return lvalue < rvalue;
});
}
} // namespace asst

View File

@@ -17,7 +17,8 @@ namespace asst
struct Result
{
std::string to_string() const
{ return "{ name: " + templ_info.name + ", matched: " + rect.to_string() + " }";
{
return "{ name: " + templ_info.name + ", matched: " + rect.to_string() + " }";
}
explicit operator std::string() const { return to_string(); }
@@ -48,5 +49,4 @@ namespace asst
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
mutable Result m_result;
};
}

View File

@@ -44,4 +44,3 @@ void MatcherConfig::_set_task_info(MatchTaskInfo task_info)
_set_roi(task_info.roi);
}

View File

@@ -7,7 +7,6 @@
namespace asst
{
class MatcherConfig
{
public:
@@ -41,5 +40,4 @@ namespace asst
protected:
Params m_params;
};
}

View File

@@ -49,5 +49,4 @@ namespace asst
protected:
Params m_params;
};
}

View File

@@ -39,7 +39,8 @@ MatchImageAnalyzer::ResultOpt MatchImageAnalyzer::analyze() const
return m_result;
}
MatchImageAnalyzer::RawResult MatchImageAnalyzer::preproc_and_match(const cv::Mat& image, const MatcherConfig::Params& params)
MatchImageAnalyzer::RawResult MatchImageAnalyzer::preproc_and_match(const cv::Mat& image,
const MatcherConfig::Params& params)
{
cv::Mat templ;
std::string templ_name;
@@ -87,4 +88,3 @@ MatchImageAnalyzer::RawResult MatchImageAnalyzer::preproc_and_match(const cv::Ma
return RawResult { .matched = matched, .templ = templ, .templ_name = templ_name };
}

View File

@@ -3,37 +3,36 @@
#include "Vision/Config/MatcherConfig.h"
namespace asst {
class MatchImageAnalyzer : public AbstractImageAnalyzer, public MatcherConfig
namespace asst
{
class MatchImageAnalyzer : public AbstractImageAnalyzer, public MatcherConfig
{
public:
using Result = MatchRect;
using ResultOpt = std::optional<Result>;
public:
using Result = MatchRect;
using ResultOpt = std::optional<Result>;
public:
using AbstractImageAnalyzer::AbstractImageAnalyzer;
virtual ~MatchImageAnalyzer() override = default;
public:
using AbstractImageAnalyzer::AbstractImageAnalyzer;
virtual ~MatchImageAnalyzer() override = default;
ResultOpt analyze() const;
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
const auto& get_result() const noexcept { return m_result; }
ResultOpt analyze() const;
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
const auto& get_result() const noexcept { return m_result; }
public:
struct RawResult
{
cv::Mat matched;
cv::Mat templ;
std::string templ_name;
public:
struct RawResult
{
cv::Mat matched;
cv::Mat templ;
std::string templ_name;
};
static RawResult preproc_and_match(const cv::Mat& image, const MatcherConfig::Params& params);
protected:
virtual void _set_roi(const Rect& roi) override { set_roi(roi); }
private:
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
mutable Result m_result;
};
static RawResult preproc_and_match(const cv::Mat& image, const MatcherConfig::Params& params);
protected:
virtual void _set_roi(const Rect& roi) override { set_roi(roi); }
private:
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
mutable Result m_result;
};
}

View File

@@ -77,4 +77,3 @@ MultiMatchImageAnalyzer::ResultsVecOpt MultiMatchImageAnalyzer::analyze() const
m_result = std::move(results);
return m_result;
}

View File

@@ -2,29 +2,28 @@
#include "AbstractImageAnalyzer.h"
#include "Vision/Config/MatcherConfig.h"
namespace asst {
class MultiMatchImageAnalyzer : public AbstractImageAnalyzer, public MatcherConfig
namespace asst
{
class MultiMatchImageAnalyzer : public AbstractImageAnalyzer, public MatcherConfig
{
public:
using Result = MatchRect;
using ResultsVec = std::vector<Result>;
using ResultsVecOpt = std::optional<ResultsVec>;
public:
using Result = MatchRect;
using ResultsVec = std::vector<Result>;
using ResultsVecOpt = std::optional<ResultsVec>;
public:
using AbstractImageAnalyzer::AbstractImageAnalyzer;
virtual ~MultiMatchImageAnalyzer() override = default;
public:
using AbstractImageAnalyzer::AbstractImageAnalyzer;
virtual ~MultiMatchImageAnalyzer() override = default;
ResultsVecOpt analyze() const;
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
const auto& get_result() const noexcept { return m_result; }
ResultsVecOpt analyze() const;
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
const auto& get_result() const noexcept { return m_result; }
protected:
virtual void _set_roi(const Rect& roi) override { set_roi(roi); }
private:
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
mutable ResultsVec m_result;
};
protected:
virtual void _set_roi(const Rect& roi) override { set_roi(roi); }
private:
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
mutable ResultsVec m_result;
};
}

View File

@@ -7,7 +7,6 @@
namespace asst
{
class OcrImageAnalyzer : public AbstractImageAnalyzer, public OCRerConfig
{
public:

View File

@@ -43,5 +43,4 @@ namespace asst
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
mutable ResultsVec m_result;
};
}

View File

@@ -45,4 +45,3 @@ OcrWithPreprocessImageAnalyzer::ResultOpt OcrWithPreprocessImageAnalyzer::analyz
m_result = result->front();
return m_result;
}

View File

@@ -24,5 +24,4 @@ namespace asst
// FIXME: 老接口太难重构了,先弄个这玩意兼容下,后续慢慢全删掉
mutable Result m_result;
};
}