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


C++ Signal::setReason方法代码示例

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


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

示例1: if

void
SignalClassifier::classifySignal(Activity *act, SignalDescription& sig,
		SuperClusterer *superClusterer, int32_t sigNum, int32_t maxCandidates)
{
	sig.pol = superClusterer->getNthPolarization(sigNum);
	sig.subchannelNumber = act->getChannel()->getSubchannel(sig.path.rfFreq);
	sig.signalId = superClusterer->getNthSignalId(sigNum);
	sig.origSignalId = SignalId();

	// initial classification of the signal depends on the
	// operating mode
	sig.sigClass = CLASS_CAND;
	sig.reason = PASSED_POWER_THRESH;

	// test for zero-drift signal
	if (operations.test(REJECT_ZERO_DRIFT_SIGNALS)) {
		float64_t absDrift = fabs(sig.path.drift);
		if (absDrift <= params.zeroDriftTolerance) {
			sig.sigClass = CLASS_RFI;
			sig.reason = ZERO_DRIFT;
		}
	}
	// test for too-big-drift signal
	if (operations.test(REJECT_ZERO_DRIFT_SIGNALS)) {
		float32_t absDrift = fabs(sig.path.drift);
		float32_t maxDrift = params.maxDriftRateTolerance
				* MHZ_TO_GHZ(params.dxSkyFreq);
		if (absDrift > maxDrift) {
				sig.sigClass = CLASS_RFI;
				sig.reason = DRIFT_TOO_HIGH;
		}
	}
	// test for recent RFI mask match
	Debug(DEBUG_SIGNAL_CLASS,
			(int32_t) operations.test(APPLY_RECENT_RFI_MASK),
			"apply recent RFI mask");
	Debug(DEBUG_SIGNAL_CLASS, (void *) recentRfi, "recent RFI mask");
	if (act->getMode() == PRIMARY) {
		if (operations.test(APPLY_RECENT_RFI_MASK) && recentRfi) {
			Debug(DEBUG_SIGNAL_CLASS, (void *) recentRfi, "apply mask?");
			if (recentRfi->isMasked(sig.path.rfFreq,
					HZ_TO_MHZ(sig.path.width))) {
				sig.sigClass = CLASS_RFI;
				sig.reason = RECENT_RFI_MATCH;
				Debug(DEBUG_SIGNAL_CLASS, (void *) recentRfi, "yep");
			} else
				Debug(DEBUG_SIGNAL_CLASS, (void *) recentRfi, "nope");
		}
	}

	// test for test signal mask match; this overrides rfi mask
	if (operations.test(APPLY_TEST_SIGNAL_MASK) && testSignal) {
		if (testSignal->isMasked(sig.path.rfFreq, HZ_TO_MHZ(sig.path.width))) {
			sig.sigClass = CLASS_CAND;
			sig.reason = TEST_SIGNAL_MATCH;
		}
	}
	// test for followup candidates; the signal must already
	// be a candidate;
	if (operations.test(FOLLOW_UP_CANDIDATES)) {
		Signal *signal = findFollowupSignal(act, sig);
		if (signal) {
			sig.origSignalId = signal->getOrigSignalId();
			if (sig.sigClass == CLASS_CAND)
				act->removeFollowupSignal(signal);
			else {
				// preserve the class/reason information for the
				// candidate
				signal->setClass(sig.sigClass);
				signal->setReason(sig.reason);
			}
		}
		else {
			sig.sigClass = CLASS_UNKNOWN;
			sig.reason = PASSED_POWER_THRESH;
		}
	}
	// if we are not selecting candidates, or we have exceeded
	// the maximum number of candidates, mark any candidate signal as
	// class unknown
	if (!operations.test(CANDIDATE_SELECTION))
		sig.sigClass = CLASS_UNKNOWN;
	else if (sig.path.rfFreq < act->getChannel()->getLowFreq()
			|| sig.path.rfFreq >= act->getChannel()->getHighFreq()) {
		sig.sigClass = CLASS_UNKNOWN;
		sig.reason = SIGNAL_NOT_IN_CHANNEL;
	}
	else if (sig.sigClass == CLASS_CAND
			&& act->getCandidateCount(ANY_TYPE) >= maxCandidates) {
		++candidatesOverMax;
		sig.sigClass = CLASS_UNKNOWN;
		sig.reason = TOO_MANY_CANDIDATES;
	}
	Debug(DEBUG_SIGNAL_CLASS, sig.signalId.number, "sig.signalId.number");
	Debug(DEBUG_SIGNAL_CLASS, sig.sigClass, "sig.sigClass");
	Debug(DEBUG_SIGNAL_CLASS, sig.reason, "sig.reason");
}
开发者ID:AgapegamerX,项目名称:SonATA,代码行数:97,代码来源:SignalClassifier.cpp


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