当前位置: 首页>>代码示例>>C++>>正文


C++ PJsonVal::GetObjInt方法代码示例

本文整理汇总了C++中PJsonVal::GetObjInt方法的典型用法代码示例。如果您正苦于以下问题:C++ PJsonVal::GetObjInt方法的具体用法?C++ PJsonVal::GetObjInt怎么用?C++ PJsonVal::GetObjInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PJsonVal的用法示例。


在下文中一共展示了PJsonVal::GetObjInt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HandleScope

TNodeJsRf24Radio* TNodeJsRf24Radio::NewFromArgs(const v8::FunctionCallbackInfo<v8::Value>& Args) {
	v8::Isolate* Isolate = v8::Isolate::GetCurrent();
	v8::HandleScope HandleScope(Isolate);

	PJsonVal ParamJson = TNodeJsUtil::GetArgJson(Args, 0);

	const int PinCE = ParamJson->GetObjInt("pinCE");
	const int PinCSN = ParamJson->GetObjInt("pinCSN");
	const uint16 MyId = (uint16) ParamJson->GetObjInt("id");
	const PJsonVal SensorJsonV = ParamJson->GetObjKey("sensors");

	const bool Verbose = ParamJson->GetObjBool("verbose", false);
	const PNotify Notify = Verbose ? TNotify::StdNotify : TNotify::NullNotify;

	Notify->OnNotify(TNotifyType::ntInfo, "Parsing configuration ...");

	TStrIntH SensorNmIdH;
	TStrIntH SensorIdNodeIdH;

	for (int SensorN = 0; SensorN < SensorJsonV->GetArrVals(); SensorN++) {
		const PJsonVal SensorJson = SensorJsonV->GetArrVal(SensorN);
		const TStr& SensorId = SensorJson->GetObjStr("id");
		SensorNmIdH.AddDat(SensorId, SensorJson->GetObjInt("internalId"));
		SensorIdNodeIdH.AddDat(SensorId, SensorJson->GetObjInt("nodeId"));
	}

	Notify->OnNotify(TNotifyType::ntInfo, "Calling cpp constructor ...");

	return new TNodeJsRf24Radio(MyId, PinCE, PinCSN, SensorNmIdH, SensorIdNodeIdH, Notify);
}
开发者ID:lstopar,项目名称:HomeDevelopment,代码行数:30,代码来源:rpinode.cpp

示例2: GenGraph

TGraphCascade::TGraphCascade(const PJsonVal& Params) {
    // build graph and node name-id maps
    PJsonVal Dag = Params->GetObjKey("dag");
    GenGraph(Dag);
    // read enabled (ignore the ones missing from the graph)
    PJsonVal EnabledNodeIdH = Params->GetObjKey("enabledNodes");
    ProcessEnabled(EnabledNodeIdH);
    PruneGraph();
    InitTimestamps();
    // read models
    PJsonVal NodeModels = Params->GetObjKey("nodeModels");
    ProcessModels(NodeModels);
    TimeUnit = Params->GetObjInt("timeUnit", 1000);
    Rnd.PutSeed(Params->GetObjInt("randSeed", 0));
}
开发者ID:Bradeskojest,项目名称:qminer,代码行数:15,代码来源:graphprocess.cpp

示例3:

TOnlineHistogram::TOnlineHistogram(const PJsonVal& ParamVal) {
	EAssertR(ParamVal->IsObjKey("lowerBound"), "TOnlineHistogram: lowerBound key missing!");
	EAssertR(ParamVal->IsObjKey("upperBound"), "TOnlineHistogram: upperBound key missing!");
	// bounded lowest point
	TFlt LBound = ParamVal->GetObjNum("lowerBound");
	// bounded highest point
	TFlt UBound = ParamVal->GetObjNum("upperBound");
	EAssertR(LBound < UBound, "TOnlineHistogram: Lower bound should be smaller than upper bound");
	// number of equal bins ? (not counting possibly infinite ones)
	TInt Bins = ParamVal->GetObjInt("bins", 5);
	EAssertR(Bins > 0, "TOnlineHistogram: Number of bins should be greater than 0");
	// include infinities in the bounds?
	TBool AddNegInf = ParamVal->GetObjBool("addNegInf", false);
	TBool AddPosInf = ParamVal->GetObjBool("addPosInf", false);
	
	MinCount = ParamVal->GetObjInt("initMinCount", 0);

	Init(LBound, UBound, Bins, AddNegInf, AddPosInf);
};
开发者ID:amrsobhy,项目名称:qminer,代码行数:19,代码来源:signalproc.cpp

示例4: New

TEma::TEma(const PJsonVal& ParamVal) : LastVal(TFlt::Mn), InitP(false) {
    // type
    TStr TypeStr = ParamVal->GetObjStr("emaType");
    if (TypeStr == "previous") { 
        Type = etPreviousPoint;
    } else if (TypeStr == "linear") {
        Type = etLinear;
    } else if (TypeStr == "next") {
        Type = etNextPoint;
    } else {
        throw TExcept::New("Unknown ema type " + TypeStr);
    }
    // rest
    TmInterval = ParamVal->GetObjNum("interval");
    InitMinMSecs = ParamVal->GetObjInt("initWindow", 0);
}
开发者ID:amrsobhy,项目名称:qminer,代码行数:16,代码来源:signalproc.cpp

示例5: EAssertR

//
// TBackupProfile
// 
TBackupProfile::TBackupProfile(const PJsonVal& SettingsJson, const TStr& Destination_, const TStr& ProfileName_)
{
    Destination = Destination_;
    if (Destination.Len() > 0 && (Destination.LastCh() != '\\' || Destination.LastCh() != '/'))
        Destination += "/";
    ProfileName = ProfileName_;
    if (!TDir::Exists(Destination))
        TDir::GenDir(Destination);
    
    VersionsToKeep = SettingsJson->GetObjInt("versionsToKeep", 1);
    PJsonVal FoldersJson = SettingsJson->GetObjKey("folders");
    EAssertR(FoldersJson->IsArr(), "Expected to get an array of folders");
    for (int N = 0; N < FoldersJson->GetArrVals(); N++) {
        PJsonVal FolderJson = FoldersJson->GetArrVal(N);
        TBackupFolderInfo FolderInfo;
        FolderInfo.Folder = FolderJson->GetObjStr("folder");
        if (FolderJson->IsObjKey("extensions"))
            FolderJson->GetObjStrV("extensions", FolderInfo.Extensions);
        if (FolderInfo.Extensions.IsIn("*"))
            FolderInfo.Extensions.Clr();
        FolderInfo.IncludeSubfolders = FolderJson->GetObjBool("includeSubfolders");
        if (FolderJson->IsObjKey("skipIfContaining"))
            FolderJson->GetObjStrV("skipIfContaining", FolderInfo.SkipIfContainingV);
        FolderV.Add(FolderInfo);
    }
    
    // load logs of the previous backups
    ProfileLogFile = Destination + ProfileName + "/backupInfo.json";
    if (TFile::Exists(ProfileLogFile)) {
        PJsonVal LogJson = TJsonVal::GetValFromStr(TStr::LoadTxt(ProfileLogFile));
        if (LogJson->IsArr()) {
            for (int N = 0; N < LogJson->GetArrVals(); N++) {
                PJsonVal Log = LogJson->GetArrVal(N);
                LogV.Add(TBackupLogInfo(Log));
            }
        }
    }
}
开发者ID:Bradeskojest,项目名称:qminer,代码行数:41,代码来源:folderbackup.cpp

示例6:

//
// TBackupLogInfo
//
TBackupLogInfo::TBackupLogInfo(const PJsonVal& Json)
{
    FolderName = Json->GetObjStr("folderName");
    SecsNeeded = Json->GetObjInt("secsNeeded");
    LogInfo = Json->GetObjStr("logInfo");
}
开发者ID:Bradeskojest,项目名称:qminer,代码行数:9,代码来源:folderbackup.cpp

示例7: PJsonVal

PJsonVal TDecisionTree::TNode::ExplainLabel(const int& Label) const {
	if (IsLeaf()) {
		if (ClassHist[Label] <= ClassHist[1 - Label]) {
			return PJsonVal();
		} else {
			const double Prob = ClassHist[Label];

			PJsonVal Result = TJsonVal::NewArr();

			PJsonVal IntersectJson = TJsonVal::NewObj();
			IntersectJson->AddToObj("covered", int(NExamples*Prob));
			IntersectJson->AddToObj("purity", Prob);
			IntersectJson->AddToObj("terms", TJsonVal::NewArr());

			Result->AddToArr(IntersectJson);

			return Result;
		}
	}

	PJsonVal Result = TJsonVal::NewArr();

	if (HasLeft()) {
		PJsonVal LeftUnion = Left->ExplainLabel(Label);

		if (!LeftUnion.Empty()) {
			if (LeftUnion->GetArrVals() == 0) {
				LeftUnion->AddToArr(TJsonVal::NewArr());
			}

			for (int i = 0; i < LeftUnion->GetArrVals(); i++) {
				PJsonVal IntersectJson = LeftUnion->GetArrVal(i);
				PJsonVal TermsJson = IntersectJson->GetObjKey("terms");
				bool HadFtr = false;
				for (int TermN = 0; TermN < TermsJson->GetArrVals(); TermN++) {
					PJsonVal TermJson = TermsJson->GetArrVal(TermN);

					const int TermFtrN = TermJson->GetObjInt("ftrId");
					if (TermFtrN == CutFtrN) {
						HadFtr = true;
						if (TermJson->GetObjNum("le") == TFlt::PInf) {
							TermJson->AddToObj("le", CutFtrVal);
						}
					}
				}
				if (!HadFtr) {
					PJsonVal TermJson = TJsonVal::NewObj();
					TermJson->AddToObj("ftrId", CutFtrN);
					TermJson->AddToObj("le", CutFtrVal);
					TermJson->AddToObj("gt", TFlt::NInf);
					TermsJson->AddToArr(TermJson);
				}

				Result->AddToArr(IntersectJson);
			}
		}
	}
	if (HasRight()) {
		PJsonVal RightUnion = Right->ExplainLabel(Label);

		if (!RightUnion.Empty()) {
			if (RightUnion->GetArrVals() == 0) {
				RightUnion->AddToArr(TJsonVal::NewArr());
			}

			for (int i = 0; i < RightUnion->GetArrVals(); i++) {
				PJsonVal IntersectJson = RightUnion->GetArrVal(i);
				PJsonVal TermsJson = IntersectJson->GetObjKey("terms");

				bool HadFtr = false;
				for (int TermN = 0; TermN < TermsJson->GetArrVals(); TermN++) {
					PJsonVal TermJson = TermsJson->GetArrVal(TermN);

					const int TermFtrN = TermJson->GetObjInt("ftrId");
					if (TermFtrN == CutFtrN) {
						HadFtr = true;
						if (TermJson->GetObjNum("gt") == TFlt::NInf) {
							TermJson->AddToObj("gt", CutFtrVal);
						}
					}
				}
				if (!HadFtr) {
					PJsonVal TermJson = TJsonVal::NewObj();
					TermJson->AddToObj("ftrId", CutFtrN);
					TermJson->AddToObj("le", TFlt::PInf);
					TermJson->AddToObj("gt", CutFtrVal);
					TermsJson->AddToArr(TermJson);
				}

				Result->AddToArr(IntersectJson);
			}
		}
	}

	return Result->GetArrVals() > 0 ? Result : PJsonVal();
}
开发者ID:Bradeskojest,项目名称:qminer,代码行数:96,代码来源:classification.cpp

示例8: P

TChiSquare::TChiSquare(const PJsonVal& ParamVal): P(TFlt::PInf) {
	// P value is set to infinity by default (null hypothesis is not rejected)
	EAssertR(ParamVal->IsObjKey("degreesOfFreedom"), "TChiSquare: degreesOfFreedom key missing!");
	// degrees of freedom
	DegreesOfFreedom = ParamVal->GetObjInt("degreesOfFreedom");
}
开发者ID:amrsobhy,项目名称:qminer,代码行数:6,代码来源:signalproc.cpp


注:本文中的PJsonVal::GetObjInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。