本文整理汇总了C++中Signal::GetSignal方法的典型用法代码示例。如果您正苦于以下问题:C++ Signal::GetSignal方法的具体用法?C++ Signal::GetSignal怎么用?C++ Signal::GetSignal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Signal
的用法示例。
在下文中一共展示了Signal::GetSignal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
/**
* Front-end side of the Spectral Analysis algorithm. Gets the
* summed signal from the back-ends, performs the spectral analysis,
* and sends the periods detected back to the back-ends to
* trace those that are new.
*
* @return 1 if the analysis target is achieved; 0 otherwise.
*/
int SpectralRoot::Run()
{
int tag;
PACKET_PTR p;
stringstream ss;
Messaging *Msgs = new Messaging();
Step ++;
/* Receive the added signal from the back-ends */
MRN_STREAM_RECV( stSpectral, &tag, p, REDUCE_SIGNAL );
Signal *DurBurstSignal = new Signal( p );
signal_t *sig_dur_burst = DurBurstSignal->GetSignal();
/* DEBUG -- Dump the signal to disk */
ss << "signal_step_" << Step << ".txt";
Spectral_DumpSignal( sig_dur_burst, (char *)ss.str().c_str() );
/* Run the spectral analysis */
int NumDetectedPeriods = 0;
int NumValidPeriods = 0;
Period_t **DetectedPeriods = NULL;
vector<signal_t *> ListOfChops;
NumDetectedPeriods = Spectral_ExecuteAnalysis(
sig_dur_burst,
Online_GetSpectralNumIters(),
(Step == 1 ? WINDOWING_10PCT : WINDOWING_NONE),
&DetectedPeriods);
for (int i=0; i<NumDetectedPeriods; i++)
{
Period_t *CurrentPeriod = DetectedPeriods[i];
signal_t *CurrentChop = Spectral_ChopSignal( sig_dur_burst, CurrentPeriod->best_ini, CurrentPeriod->best_end );
if (CurrentChop != NULL)
{
NumValidPeriods ++;
}
ListOfChops.push_back( CurrentChop );
}
Msgs->debug(cerr, "Detected %d period(s) - %d valid", NumDetectedPeriods, NumValidPeriods);
/* Send the number of valid periods (if a chop is null, that period is not counted) */
MRN_STREAM_SEND(stSpectral, SPECTRAL_DETECTED_PERIODS, "%d", NumValidPeriods);
/* Process every period */
for (int i=0; i<NumDetectedPeriods; i++)
{
Period_t *CurrentPeriod = DetectedPeriods[i];
int TraceThisPeriod = 0;
int RepresentativePeriodID = -1;
/* Skip the period if the chop is empty */
if (ListOfChops[i] != NULL)
{
/* Check if this period has been seen before */
RepresentativePeriodID = FindRepresentative( ListOfChops[i], CurrentPeriod );
/* Decide if current period will be traced */
TraceThisPeriod = (
((TotalPeriodsTraced < Online_GetSpectralMaxPeriods()) ||
(Online_GetSpectralMaxPeriods() == 0)) && /* Not traced enough */
(!Get_RepIsTraced(RepresentativePeriodID)) && /* Not traced before */
(Get_RepIsSeen(RepresentativePeriodID) > Online_GetSpectralMinSeen()) /* Seen enough times */
);
if (TraceThisPeriod)
{
/* Mark that this period is going to be traced */
Set_RepIsTraced(RepresentativePeriodID, 1);
}
/* Transfer the period information to the back-ends */
MRN_STREAM_SEND(stSpectral, SPECTRAL_PERIOD, "%f %ld %lf %lf %lf %ld %ld %ld %ld %d %d",
CurrentPeriod->iters,
CurrentPeriod->length,
CurrentPeriod->goodness,
CurrentPeriod->goodness2,
CurrentPeriod->goodness3,
CurrentPeriod->ini,
CurrentPeriod->end,
CurrentPeriod->best_ini,
CurrentPeriod->best_end,
TraceThisPeriod,
RepresentativePeriodID
);
}
xfree (DetectedPeriods[i]);
}
xfree (DetectedPeriods);
//.........这里部分代码省略.........