/* * @Author: lishengyin lishengyin@sz-sunwin.com * @Date: 2022-09-04 20:42:45 * @LastEditors: lishengyin * @LastEditTime: 2022-09-08 10:24:21 * @FilePath: /gsd_check/models/config.cpp * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ #include "config.hpp" namespace gsd { // 获取单例 shared_ptr config::getPtr(){ static std::shared_ptr m_config = nullptr; if(m_config == nullptr) m_config = std::shared_ptr(new config); return m_config; } /** * @description: 获取版本号 * @return {*} */ std::string config::getVersion(){ std::string version; version = std::to_string(GSD_MAJOR_VERSION) + "." + std::to_string(GSD_MINOR_VERSION) + "." + std::to_string(GSD_PATCH_VERSION); return version; } /** * @description: getApp * @return {*} */ std::string config::getApp(){ ifstream fin; fin.open("/etc/gsd/gsdApp", ios::in); if (!fin.is_open()){ ErrorL << "无法找到这个文件!" << endl; return ""; } char buff[1024] = { 0 }; while (fin >> buff); fin.close(); std::string str = buff; return str; } /** * @description: 获取 * @return {*} */ vector config::getInferTargets(){ unique_lock lk(this->m_mtx); return this->InferTargets; } /** * @description: InferTargets * @param {vector} data * @return {*} */ void config::setInferTargets(vector data){ unique_lock lk(this->m_mtx); this->InferTargets = data; } /** * @description: getAlienLabels * @return {*} */ vector config::getAlienLabels(){ return this->AlienLabels; } /** * @description: setAlienLabels * @return {*} */ void config::setAlienLabels(vector data){ this->AlienLabels = data; } } // namespace gsd