You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*
* @Author: xiewenji 527774126@qq.com
* @Date: 2025-09-11 15:32:54
* @LastEditors: xiewenji 527774126@qq.com
* @LastEditTime: 2025-09-13 18:49:40
* @FilePath: /BOE_CELL_AOI_Detect/ConfigModule/include/ConfigBase.h
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
#ifndef ConfigBase_H_
#define ConfigBase_H_
#include <string>
#include <unordered_map>
#include <memory>
#define CONFIGBASE_VERSION 4
#define EMPTY_CONFIG_NAME "ALL"
enum CONFIG_TYPE_
{
ConfigType_Analysisy_Common_XL,
ConfigType_Check_XL,
ConfigType_Image_In,
ConfigType_Image_out,
ConfigType_BloB,
ConfigType_Count,
};
struct ImageInfo
{
int width;
int height;
int channels;
ImageInfo()
{
width = 0;
height = 0;
channels = 0;
}
void copy(ImageInfo tem)
{
this->width = tem.width;
this->height = tem.height;
this->channels = tem.channels;
}
void print(std::string str)
{
printf("%s width=%d height=%d channels=%d\n", str.c_str(), width, height, channels);
}
};
class ConfigBase
{
protected:
ConfigBase() {}
public:
// delete camera interface
~ConfigBase() {}
static std::shared_ptr<ConfigBase> GetInstance();
virtual int GetConfigIdx() = 0;
// 获取参数更新状态 true 有更新
virtual bool GetConfigUpdataStatus(int nConfigType, int nidx) = 0;
// 复制想使用的参数
virtual int GetConfig(int nConfigType, void *pconfig) = 0;
// 更新参数 pconfig 参数指针nConfigType 需要更新的参数类型 返回0 成功 其他异常
virtual int UpdateConfig(void *pconfig, int nConfigType) = 0;
virtual int UpdateJSONConfig(void *pconfig, int nConfigType) = 0;
// 返回检测版本信息
virtual std::string GetVersion() = 0;
// 返回错误信息
virtual std::string GetErrorInfo() = 0;
};
class ConfigManagerBase
{
protected:
ConfigManagerBase() {}
public:
// delete camera interface
~ConfigManagerBase() {}
static ConfigManagerBase *GetInstance();
virtual int LoadAnalysisConfig(std::string strConfigPath) = 0;
virtual int UpdateConfig() = 0;
virtual int GetConfig(int nConfigType, void *pconfig) = 0;
static ConfigManagerBase *m_pInstance;
public:
std::unordered_map<std::string, std::shared_ptr<ConfigBase>> Config_instances_;
};
#endif