| | |
| | | // |
| | | // 对比报警的基类 |
| | | // Created by ps on 2/26/18. |
| | | // |
| | | |
| | |
| | | #include <basic/util/thread/MultiThread.h> |
| | | #include <basic/util/BASE64/Base64.h> |
| | | |
| | | /*** |
| | | * 需要对比的一条记录 |
| | | */ |
| | | struct AlarmData { |
| | | int num; |
| | | std::string tableName; |
| | |
| | | float threshold; |
| | | }; |
| | | |
| | | /*** |
| | | * 数据库中查询的一条记录 |
| | | */ |
| | | struct FeatureData { |
| | | long face_id; |
| | | std::string uuid; |
| | |
| | | std::string idcard; |
| | | }; |
| | | |
| | | /*** |
| | | * 字符串根据符号分割并返回数据 |
| | | * @param str_list |
| | | * @return |
| | | */ |
| | | static std::vector<std::string> AlarmServerPropertyAnalyseByComma(std::string str_list) { |
| | | std::vector<std::string> result; |
| | | char *property_list = const_cast<char *>(str_list.c_str()); |
| | |
| | | CPU_Number = 1 |
| | | }; |
| | | |
| | | /*** |
| | | * 报警服务基类 |
| | | */ |
| | | class AlarmServer { |
| | | |
| | | public: |
| | |
| | | dataRemoveBuffer.clear(); |
| | | } |
| | | |
| | | /*** |
| | | * 初始化时使用线程加载数据库 |
| | | * @param str_config |
| | | */ |
| | | void initDB(std::string str_config) { |
| | | std::thread thd(loadDBCahce, this, str_config); |
| | | thd.detach(); |
| | | } |
| | | |
| | | /*** |
| | | * 移除数据 |
| | | * @param key |
| | | */ |
| | | void removeData(std::string key) { |
| | | std::lock_guard<std::mutex> guard(dataRemoveBufferMtx); |
| | | dataRemoveBuffer.insert(key); |