当前位置: 首页 > news >正文

学做美食的视频网站html设计个人网页

学做美食的视频网站,html设计个人网页,网站推广途径及要点,厦门网站优化服务c11 json解析库nlohmann/json.hpp文件整个代码由一个头文件组成 json.hpp#xff0c;没有子项目#xff0c;没有依赖关系#xff0c;没有复杂的构建系统#xff0c;使用起来非常方便。 json.hpp库在文章末尾下载 读写主要有两种方式#xff0c;第一种根据键值对读写11 json解析库nlohmann/json.hpp文件整个代码由一个头文件组成 json.hpp没有子项目没有依赖关系没有复杂的构建系统使用起来非常方便。 json.hpp库在文章末尾下载 读写主要有两种方式第一种根据键值对读写第二种直接遍历json文件读写。 1、根据键值对读写 假设有个json文件格式如下 {test: [{FixedParameters: {bit_depth: 10,dark_level: 5.5,dark_time: 100,dynamic_range: 0.1},InitialParameters:{InitialTime:20,rate:50},JudgmentMechanism:{max_time: 100000,min_time: 0,rangeMax: 0.9,rangeMin: 0.3,targetMax: 0.9,targetMin: 0.5},IterationStepLength:{belowNormalRange:1.5,aboveNormalRange:2,totalIterations:10},IsUseROIs:{isUseROIs:false,isCalculateEntireROIGray:false,pixelTotalNumber:1000,isUseWeightedAverage:false,ROIS:[{Name:ROI1,weight:1,x:0,y:0,width:100,height:100}]},Index: 1,Name: data1,SerialNumber: 0000000000},{FixedParameters: {bit_depth: 200,dark_level: 10.0,dark_time: 3000,dynamic_range: 0.5},InitialParameters:{InitialTime:0,rate:20},JudgmentMechanism:{max_time: 200000,min_time: 11111,rangeMax: 0.9,rangeMin: 0.3,targetMax: 0.9,targetMin: 0.5},IterationStepLength:{belowNormalRange:1.5,aboveNormalRange:2,totalIterations:10},IsUseROIs:{isUseROIs:false,isCalculateEntireROIGray:false,pixelTotalNumber:1000,isUseWeightedAverage:false,ROIS:[{Name:ROI1,weight:1,x:0,y:0,width:100,height:200}]},Index: 2,Name: data2,SerialNumber: 1111111111}] }读json文件 头文件的部分内容 #pragma once #include iostream #include fstream #include string #include mutex #include json.hpp using namespace std; using json nlohmann::ordered_json;struct FixedParameters_ {int bit_depth;double dark_level;double dark_time;double dynamic_range; };struct InitialParameters_ {int InitialTime;bool isAutoUpdateInitTime;bool isAutoUpdateMaxMinTime;int rate; };struct JudgmentMechanism_ {int max_time;int min_time;double rangeMax;double rangeMin;double target_max;double target_min; };struct IterationStepLength_ {double belowNormalRange;double aboveNormalRange;int totalIterations; };struct ROIS {double weight;int x;int y;int width;int height; };struct IsUseROIs_ {bool isUseROIs;bool isCalculateEntireROIGray;int pixelTotalNumber;bool isUseWeightedAverage;std::mapstd::string, ROIS rois; };struct Param {FixedParameters_ fixedParameters;InitialParameters_ initialParameters;JudgmentMechanism_ judgmentMechanism;IterationStepLength_ iterationStepLength;IsUseROIs_ isUseROIs;std::string SN; };struct AEConfig {std::mapstd::string, Param AE_Config; };class ReadWriteConfig { public:static ReadWriteConfig *getinstance();ReadWriteConfig();//read/write jsonAEConfig ReadAEConfig(string configPath);void WriteAEConfig(AEConfig AE_Config, string configPath);private:static ReadWriteConfig *m_ReadWriteConfig;string path;json m_JsonConfig; };CPP部分 AEConfig ReadWriteConfig::ReadAEConfig(string configPath) {m_mutex.lock();if (configPath ! )path configPath;std::ifstream ifs(path, std::fstream::in);if (ifs.fail()){//return 0;m_mutex.unlock();throw std::runtime_error(Unable to open AEConfig File.);}ifs m_JsonConfig;ifs.close();AEConfig AE_Config;auto AEConfig m_JsonConfig[test];for (auto it : AEConfig.items()){string cameraName it.value()[Name].getstring();AE_Config.AE_Config[cameraName].SN it.value()[SerialNumber].getstring();AE_Config.AE_Config[cameraName].fixedParameters.bit_depth it.value()[FixedParameters][bit_depth].getint();AE_Config.AE_Config[cameraName].fixedParameters.dark_level it.value()[FixedParameters][dark_level].getdouble();AE_Config.AE_Config[cameraName].fixedParameters.dark_time it.value()[FixedParameters][dark_time].getdouble();AE_Config.AE_Config[cameraName].fixedParameters.dynamic_range it.value()[FixedParameters][dynamic_range].getdouble();AE_Config.AE_Config[cameraName].initialParameters.InitialTime it.value()[InitialParameters][InitialTime].getint();AE_Config.AE_Config[cameraName].initialParameters.isAutoUpdateInitTime it.value()[InitialParameters][isAutoUpdateInitTime].getbool();AE_Config.AE_Config[cameraName].initialParameters.isAutoUpdateMaxMinTime it.value()[InitialParameters][isAutoUpdateMaxMinTime].getbool();AE_Config.AE_Config[cameraName].initialParameters.rate it.value()[InitialParameters][rate].getint();AE_Config.AE_Config[cameraName].judgmentMechanism.max_time it.value()[JudgmentMechanism][max_time].getint();AE_Config.AE_Config[cameraName].judgmentMechanism.min_time it.value()[JudgmentMechanism][min_time].getint();AE_Config.AE_Config[cameraName].judgmentMechanism.rangeMax it.value()[JudgmentMechanism][rangeMax].getdouble();AE_Config.AE_Config[cameraName].judgmentMechanism.rangeMin it.value()[JudgmentMechanism][rangeMin].getdouble();AE_Config.AE_Config[cameraName].judgmentMechanism.target_max it.value()[JudgmentMechanism][targetMax].getdouble();AE_Config.AE_Config[cameraName].judgmentMechanism.target_min it.value()[JudgmentMechanism][targetMin].getdouble();AE_Config.AE_Config[cameraName].iterationStepLength.belowNormalRange it.value()[IterationStepLength][belowNormalRange].getdouble();AE_Config.AE_Config[cameraName].iterationStepLength.aboveNormalRange it.value()[IterationStepLength][aboveNormalRange].getdouble();AE_Config.AE_Config[cameraName].iterationStepLength.totalIterations it.value()[IterationStepLength][totalIterations].getint();AE_Config.AE_Config[cameraName].isUseROIs.isUseROIs it.value()[IsUseROIs][isUseROIs].getbool();AE_Config.AE_Config[cameraName].isUseROIs.isCalculateEntireROIGray it.value()[IsUseROIs][isCalculateEntireROIGray].getbool();AE_Config.AE_Config[cameraName].isUseROIs.pixelTotalNumber it.value()[IsUseROIs][pixelTotalNumber].getint();AE_Config.AE_Config[cameraName].isUseROIs.isUseWeightedAverage it.value()[IsUseROIs][isUseWeightedAverage].getbool();auto roiConfig it.value()[IsUseROIs][ROIS];for (auto it : roiConfig.items()){string roiName it.value()[Name].getstring();ROIS rois;rois.weight it.value()[weight].getdouble();rois.x it.value()[x].getint();rois.y it.value()[y].getint();rois.width it.value()[width].getint();rois.height it.value()[height].getint();AE_Config.AE_Config[cameraName].isUseROIs.rois[roiName] rois;}}m_mutex.unlock();return AE_Config; }写json文件 void ReadWriteConfig::WriteAEConfig(AEConfig AE_Config, string configPath) {m_mutex.lock();if (configPath ! )path configPath;m_JsonConfig[test].clear();for (auto gt AE_Config.AE_Config.begin(); gt ! AE_Config.AE_Config.end(); gt){json AutoExposure;AutoExposure[Name] gt-first;AutoExposure[SerialNumber] gt-second.SN;AutoExposure[FixedParameters][bit_depth] gt-second.fixedParameters.bit_depth;AutoExposure[FixedParameters][dark_level] gt-second.fixedParameters.dark_level;AutoExposure[FixedParameters][dark_time] gt-second.fixedParameters.dark_time;AutoExposure[FixedParameters][dynamic_range] gt-second.fixedParameters.dynamic_range;AutoExposure[InitialParameters][InitialTime] gt-second.initialParameters.InitialTime;AutoExposure[InitialParameters][isAutoUpdateInitTime] gt-second.initialParameters.isAutoUpdateInitTime;AutoExposure[InitialParameters][isAutoUpdateMaxMinTime] gt-second.initialParameters.isAutoUpdateMaxMinTime;AutoExposure[InitialParameters][rate] gt-second.initialParameters.rate;AutoExposure[JudgmentMechanism][max_time] gt-second.judgmentMechanism.max_time;AutoExposure[JudgmentMechanism][min_time] gt-second.judgmentMechanism.min_time;AutoExposure[JudgmentMechanism][rangeMax] gt-second.judgmentMechanism.rangeMax;AutoExposure[JudgmentMechanism][rangeMin] gt-second.judgmentMechanism.rangeMin;AutoExposure[JudgmentMechanism][targetMax] gt-second.judgmentMechanism.target_max;AutoExposure[JudgmentMechanism][targetMin] gt-second.judgmentMechanism.target_min;AutoExposure[IterationStepLength][belowNormalRange] gt-second.iterationStepLength.belowNormalRange;AutoExposure[IterationStepLength][aboveNormalRange] gt-second.iterationStepLength.aboveNormalRange;AutoExposure[IterationStepLength][totalIterations] gt-second.iterationStepLength.totalIterations;AutoExposure[IsUseROIs][isUseROIs] gt-second.isUseROIs.isUseROIs;AutoExposure[IsUseROIs][isCalculateEntireROIGray] gt-second.isUseROIs.isCalculateEntireROIGray;AutoExposure[IsUseROIs][pixelTotalNumber] gt-second.isUseROIs.pixelTotalNumber;AutoExposure[IsUseROIs][isUseWeightedAverage] gt-second.isUseROIs.isUseWeightedAverage;for (auto it gt-second.isUseROIs.rois.begin(); it ! gt-second.isUseROIs.rois.end(); it){json roi;roi[Name] it-first;roi[weight] it-second.weight;roi[x] it-second.x;roi[y] it-second.y;roi[width] it-second.width;roi[height] it-second.height;AutoExposure[IsUseROIs][ROIS].push_back(roi);}m_JsonConfig[test].push_back(AutoExposure);}std::ofstream os(path);if (os.fail()){//return 0;m_mutex.unlock();throw std::runtime_error(Unable to open AEConfig File.);}os m_JsonConfig.dump(4);os.close();m_mutex.unlock(); } json.hpp库下载
http://www.pierceye.com/news/20572/

相关文章:

  • wordpress网站统计途牛网站大数据建设
  • 建设电子商务网站前的市场分析线上推广招聘
  • 环保推广哪个网站好哪建设网站好
  • 门户网站建设开发金塔精神文明建设网站
  • 直播网站建设需要什么软件做公司网站 国外系统
  • 想制作一个网站怎么来做关于互联网的网站
  • 学校网站建设规划书做文件的网站
  • 小说网站模板中国企业信用信息公示网查询系统
  • 网站建设中模板下载网站运营解决方案
  • 安徽电商网站建设凡科网邮箱登陆
  • 中国国家标准建设信息网站用wordpress建立专业网站视频教程
  • 兰州网站制作怎么样建设门户网站发展前景2018
  • 网站开发需要用到哪些设备友情链接样式
  • 生态环境工程公司网站建设关于公司门户网站建设的议案
  • 宝安做棋牌网站建设找哪家效益快载wordpress
  • 效果好的免费网站建设建筑设计公司属于什么行业
  • 企业网站建设方案应该怎么做上海建设摩托车
  • 糖果网站是李笑来做的吗网页设计与制作教程实验报告
  • 建设银行长沙招聘网站软件外包平台哪家好
  • 医院网站cms东山县城乡规划建设局网站
  • 纳雍网站建设公司网站建设 需要多少空间
  • 求一个手机能看的网站网站建设经验交流
  • 网站开发liucheng网站模版 模板
  • 四川专做餐饮的网站wordpress怎么添加价格和购物车
  • 凡科网站建设公司wordpress会员vip插件
  • 制作网站协议书wordpress 输出子分类
  • 新氧整形网站开发模版青岛正规网站设计公司
  • 芜湖网站设计公司中国十大建筑设计院排名
  • 长沙米拓建站上海高端室内设计
  • 网站左侧漂浮导航wordpress 搜索 404