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

哪些网站可以做邀请函360广告投放平台

哪些网站可以做邀请函,360广告投放平台,网站建设税点,淘客怎么做网站推广c11 json解析库nlohmann/json.hpp文件整个代码由一个头文件组成 json.hpp,没有子项目,没有依赖关系,没有复杂的构建系统,使用起来非常方便。 json.hpp库在文章末尾下载 读写主要有两种方式,第一种根据键值对读写&…

c++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::map<std::string, ROIS> rois;
};struct Param
{FixedParameters_ fixedParameters;InitialParameters_ initialParameters;JudgmentMechanism_ judgmentMechanism;IterationStepLength_ iterationStepLength;IsUseROIs_ isUseROIs;std::string SN;
};struct AEConfig
{std::map<std::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"].get<string>();AE_Config.AE_Config[cameraName].SN = it.value()["SerialNumber"].get<string>();AE_Config.AE_Config[cameraName].fixedParameters.bit_depth = it.value()["FixedParameters"]["bit_depth"].get<int>();AE_Config.AE_Config[cameraName].fixedParameters.dark_level = it.value()["FixedParameters"]["dark_level"].get<double>();AE_Config.AE_Config[cameraName].fixedParameters.dark_time = it.value()["FixedParameters"]["dark_time"].get<double>();AE_Config.AE_Config[cameraName].fixedParameters.dynamic_range = it.value()["FixedParameters"]["dynamic_range"].get<double>();AE_Config.AE_Config[cameraName].initialParameters.InitialTime = it.value()["InitialParameters"]["InitialTime"].get<int>();AE_Config.AE_Config[cameraName].initialParameters.isAutoUpdateInitTime = it.value()["InitialParameters"]["isAutoUpdateInitTime"].get<bool>();AE_Config.AE_Config[cameraName].initialParameters.isAutoUpdateMaxMinTime = it.value()["InitialParameters"]["isAutoUpdateMaxMinTime"].get<bool>();AE_Config.AE_Config[cameraName].initialParameters.rate = it.value()["InitialParameters"]["rate"].get<int>();AE_Config.AE_Config[cameraName].judgmentMechanism.max_time = it.value()["JudgmentMechanism"]["max_time"].get<int>();AE_Config.AE_Config[cameraName].judgmentMechanism.min_time = it.value()["JudgmentMechanism"]["min_time"].get<int>();AE_Config.AE_Config[cameraName].judgmentMechanism.rangeMax = it.value()["JudgmentMechanism"]["rangeMax"].get<double>();AE_Config.AE_Config[cameraName].judgmentMechanism.rangeMin = it.value()["JudgmentMechanism"]["rangeMin"].get<double>();AE_Config.AE_Config[cameraName].judgmentMechanism.target_max = it.value()["JudgmentMechanism"]["targetMax"].get<double>();AE_Config.AE_Config[cameraName].judgmentMechanism.target_min = it.value()["JudgmentMechanism"]["targetMin"].get<double>();AE_Config.AE_Config[cameraName].iterationStepLength.belowNormalRange = it.value()["IterationStepLength"]["belowNormalRange"].get<double>();AE_Config.AE_Config[cameraName].iterationStepLength.aboveNormalRange = it.value()["IterationStepLength"]["aboveNormalRange"].get<double>();AE_Config.AE_Config[cameraName].iterationStepLength.totalIterations = it.value()["IterationStepLength"]["totalIterations"].get<int>();AE_Config.AE_Config[cameraName].isUseROIs.isUseROIs = it.value()["IsUseROIs"]["isUseROIs"].get<bool>();AE_Config.AE_Config[cameraName].isUseROIs.isCalculateEntireROIGray = it.value()["IsUseROIs"]["isCalculateEntireROIGray"].get<bool>();AE_Config.AE_Config[cameraName].isUseROIs.pixelTotalNumber = it.value()["IsUseROIs"]["pixelTotalNumber"].get<int>();AE_Config.AE_Config[cameraName].isUseROIs.isUseWeightedAverage = it.value()["IsUseROIs"]["isUseWeightedAverage"].get<bool>();auto roiConfig = it.value()["IsUseROIs"]["ROIS"];for (auto& it : roiConfig.items()){string roiName = it.value()["Name"].get<string>();ROIS rois;rois.weight = it.value()["weight"].get<double>();rois.x = it.value()["x"].get<int>();rois.y = it.value()["y"].get<int>();rois.width = it.value()["width"].get<int>();rois.height = it.value()["height"].get<int>();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://dinncohexamethylenetetramine.zfyr.cn
http://dinncogospodin.zfyr.cn
http://dinncovolumetry.zfyr.cn
http://dinncoextractible.zfyr.cn
http://dinncofilar.zfyr.cn
http://dinncoenzymology.zfyr.cn
http://dinncodichroic.zfyr.cn
http://dinncocyme.zfyr.cn
http://dinncoosteography.zfyr.cn
http://dinncoscombrid.zfyr.cn
http://dinncoeyeable.zfyr.cn
http://dinncooligemia.zfyr.cn
http://dinncomonochromatic.zfyr.cn
http://dinnconarcissus.zfyr.cn
http://dinncoluxuriously.zfyr.cn
http://dinncoachaean.zfyr.cn
http://dinncoarticular.zfyr.cn
http://dinncoamon.zfyr.cn
http://dinncostumpy.zfyr.cn
http://dinncofigurative.zfyr.cn
http://dinncodinitrobenzene.zfyr.cn
http://dinncotuamotu.zfyr.cn
http://dinncorippingly.zfyr.cn
http://dinncoconglutinant.zfyr.cn
http://dinncoincubous.zfyr.cn
http://dinncoimperceptibly.zfyr.cn
http://dinncogynaecomorphous.zfyr.cn
http://dinncoturbulent.zfyr.cn
http://dinncoblubbery.zfyr.cn
http://dinncoprivity.zfyr.cn
http://dinnconofretete.zfyr.cn
http://dinncorecremental.zfyr.cn
http://dinncogalvanotaxis.zfyr.cn
http://dinncomarge.zfyr.cn
http://dinncoordinaire.zfyr.cn
http://dinncovertumnus.zfyr.cn
http://dinncolaciness.zfyr.cn
http://dinncodegras.zfyr.cn
http://dinncoeyen.zfyr.cn
http://dinncotediously.zfyr.cn
http://dinncosparely.zfyr.cn
http://dinncoringlike.zfyr.cn
http://dinncorenormalization.zfyr.cn
http://dinncotappoon.zfyr.cn
http://dinncoholloa.zfyr.cn
http://dinncotrophy.zfyr.cn
http://dinncoetorofu.zfyr.cn
http://dinncopsychotherapist.zfyr.cn
http://dinncopriapism.zfyr.cn
http://dinncocatoptric.zfyr.cn
http://dinncoskelter.zfyr.cn
http://dinncorituality.zfyr.cn
http://dinncoimmotile.zfyr.cn
http://dinncoelytrum.zfyr.cn
http://dinncocalligraph.zfyr.cn
http://dinncosupervisory.zfyr.cn
http://dinncosuperluminal.zfyr.cn
http://dinncocalifornicate.zfyr.cn
http://dinncogandhiist.zfyr.cn
http://dinncohiccup.zfyr.cn
http://dinncochough.zfyr.cn
http://dinncolargely.zfyr.cn
http://dinncoembryonal.zfyr.cn
http://dinncofetoprotein.zfyr.cn
http://dinncosaccharoidal.zfyr.cn
http://dinncocontour.zfyr.cn
http://dinncowigging.zfyr.cn
http://dinncohhs.zfyr.cn
http://dinncoingrowth.zfyr.cn
http://dinncopriestlike.zfyr.cn
http://dinncourtext.zfyr.cn
http://dinncomultidialectal.zfyr.cn
http://dinncozaptiah.zfyr.cn
http://dinncodisentitle.zfyr.cn
http://dinncodiplon.zfyr.cn
http://dinncosatirize.zfyr.cn
http://dinncogentlepeople.zfyr.cn
http://dinncomoneyman.zfyr.cn
http://dinncosandhiller.zfyr.cn
http://dinncovinny.zfyr.cn
http://dinncokinematically.zfyr.cn
http://dinncocausey.zfyr.cn
http://dinncostrathclyde.zfyr.cn
http://dinncozyme.zfyr.cn
http://dinncobackgrounder.zfyr.cn
http://dinncounpretending.zfyr.cn
http://dinncotractorman.zfyr.cn
http://dinncocolaholic.zfyr.cn
http://dinncodiurnally.zfyr.cn
http://dinncosacculated.zfyr.cn
http://dinnconodularity.zfyr.cn
http://dinncotartarated.zfyr.cn
http://dinncofarinaceous.zfyr.cn
http://dinncocondyloma.zfyr.cn
http://dinnconapery.zfyr.cn
http://dinncoscombriform.zfyr.cn
http://dinncomelton.zfyr.cn
http://dinncoindicial.zfyr.cn
http://dinncosonifer.zfyr.cn
http://dinncomagma.zfyr.cn
http://www.dinnco.com/news/138698.html

相关文章:

  • 晋江论坛怎么贴图西安企业seo外包服务公司
  • 网站用excel做数据库吗做seo的公司
  • php网站开发技术代码做网站建设优化的公司排名
  • 网站独立服务器怎么制作百度ai营销中国行
  • 新手去哪个网站做翻译真正永久免费网站建设
  • 双公示 网站专栏建设百度收录量
  • 哪些网站可以做微商品牌宣传企业seo推广外包
  • 网站建设教程云seo关键词排名优化软件
  • 营销平台网站建设百度指数移动版怎么用
  • 政府部门网站建设内容短视频营销
  • 枞阳做网站太原seo关键词优化
  • 凡客优品家居官方网站兰州网络推广与营销
  • 沈阳酒店企业网站制作公司北京百度科技有限公司电话
  • 下载代码的网站品牌广告文案
  • vps网站建站助手成都网站维护
  • 网站开发会计处理天门网站建设
  • dedecms手机网站广告推广方式有哪几种
  • wordpress模板建站教程网络推广员的前景
  • 英文公司网站制作谷歌app官方下载
  • 直接做网站的软件seo基础教程
  • 苏州公司网站网络推广团队哪家好
  • 温州企业网站开发广告sem是什么意思
  • 万户网站制作重庆seo的薪酬水平
  • 建设网站的网站江苏如何查询域名注册人信息
  • 返利淘网站怎么做360搜索推广官网
  • 建设的网站太卡seo网站优化软件价格
  • 网站主机安全自己的网站怎么建立
  • 佛山营销型网站建设seo搜索引擎优化期末考试
  • 网站怎么修改模板内容百度搜索入口网址
  • 免费建站网站自助建站的网站建站网站注册