12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- /*
- * @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> config::getPtr(){
- static std::shared_ptr<config> m_config = nullptr;
- if(m_config == nullptr) m_config = std::shared_ptr<config>(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<int> config::getInferTargets(){
- unique_lock<std::mutex> lk(this->m_mtx);
- return this->InferTargets;
- }
- /**
- * @description: InferTargets
- * @param {vector<int>} data
- * @return {*}
- */
- void config::setInferTargets(vector<int> data){
- unique_lock<std::mutex> lk(this->m_mtx);
- this->InferTargets = data;
- }
- /**
- * @description: getAlienLabels
- * @return {*}
- */
- vector<int> config::getAlienLabels(){
- return this->AlienLabels;
- }
- /**
- * @description: setAlienLabels
- * @return {*}
- */
- void config::setAlienLabels(vector<int> data){
- this->AlienLabels = data;
- }
- } // namespace gsd
|