本文整理汇总了C++中settings::fetch方法的典型用法代码示例。如果您正苦于以下问题:C++ settings::fetch方法的具体用法?C++ settings::fetch怎么用?C++ settings::fetch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类settings
的用法示例。
在下文中一共展示了settings::fetch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_wu_headers
int make_wu_headers(tapeheader_t tapeheader[],workunit wuheader[],
buffer_pos_t *start_of_wu) {
int procid=getpid();
int i,j,startframe=start_of_wu->frame;
double receiver_freq;
int bandno;
SCOPE_STRING *lastpos;
FILE *tmpfile;
char tmpstr[256];
char buf[64];
static int HaveConfigTable=0;
static ReceiverConfig_t ReceiverConfig;
static receiver_config r;
static settings s;
if(!HaveConfigTable) {
sprintf(buf,"where s4_id=%d",gregorian?AOGREG_1420:AO_1420);
r.fetch(std::string(buf));
ReceiverConfig.ReceiverID=r.s4_id;
strlcpy(ReceiverConfig.ReceiverName,r.name,
sizeof(ReceiverConfig.ReceiverName));
ReceiverConfig.Latitude=r.latitude;
ReceiverConfig.Longitude=r.longitude;
ReceiverConfig.WLongitude=-r.longitude;
ReceiverConfig.Elevation=r.elevation;
ReceiverConfig.Diameter=r.diameter;
ReceiverConfig.BeamWidth=r.beam_width;
ReceiverConfig.CenterFreq=r.center_freq;
ReceiverConfig.AzOrientation=r.az_orientation;
for (i=0;i<(sizeof(ReceiverConfig.ZenCorrCoeff)/sizeof(ReceiverConfig.ZenCorrCoeff[0]));i++) {
ReceiverConfig.ZenCorrCoeff[i]=r.zen_corr_coeff[i];
ReceiverConfig.AzCorrCoeff[i]=r.az_corr_coeff[i];
}
HaveConfigTable=1;
}
sprintf(buf,"where active=%d",app.id);
if (!s.fetch(std::string(buf))) {
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to find active settings for app.id=%d\n",app.id);
exit(1);
}
if (s.receiver_cfg->id != r.id) {
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Receiver config does not match settings (%d != %d)\n",s.receiver_cfg->id, r.id);
exit(1);
}
s.recorder_cfg->fetch();
s.splitter_cfg->fetch();
s.analysis_cfg->fetch();
if (!strncmp(s.splitter_cfg->data_type,"encoded",
std::min(static_cast<size_t>(7),sizeof(s.splitter_cfg->data_type)))) {
noencode=0;
} else {
noencode=1;
}
workunit_grp wugrp;
sprintf(wugrp.name,"%s.%ld.%d.%ld.%d",tapeheader[startframe].name,
procid,
(current_record-TAPE_RECORDS_IN_BUFFER)*8+startframe,
start_of_wu->byte,s.id);
wugrp.receiver_cfg=r;
wugrp.recorder_cfg=s.recorder_cfg;
wugrp.splitter_cfg=s.splitter_cfg;
wugrp.analysis_cfg=s.analysis_cfg;
wugrp.data_desc.start_ra=tapeheader[startframe+1].telstr.ra;
wugrp.data_desc.start_dec=tapeheader[startframe+1].telstr.dec;
wugrp.data_desc.end_ra=tapeheader[startframe+TAPE_FRAMES_PER_WU].telstr.ra;
wugrp.data_desc.end_dec=tapeheader[startframe+TAPE_FRAMES_PER_WU].telstr.dec;
wugrp.data_desc.nsamples=NSAMPLES;
wugrp.data_desc.true_angle_range=0;
{
double sample_rate=tapeheader[startframe].samplerate/NSTRIPS;
/* startframe+1 contains the first valid RA and Dec */
TIME st=tapeheader[startframe+1].telstr.st;
TIME et=tapeheader[startframe+TAPE_FRAMES_PER_WU].telstr.st;
double diff=(et-st).jd*86400.0;
for (j=2;j<TAPE_FRAMES_PER_WU;j++) {
wugrp.data_desc.true_angle_range+=angdist(tapeheader[startframe+j-1].telstr,tapeheader[startframe+j].telstr);
}
wugrp.data_desc.true_angle_range*=(double)wugrp.data_desc.nsamples/(double)sample_rate/diff;
if (wugrp.data_desc.true_angle_range==0) wugrp.data_desc.true_angle_range=1e-10;
}
// Calculate the number of unique signals that could be found in a workunit.
// We will use these numbers to calculate thresholds.
double numgauss=2.36368e+08/wugrp.data_desc.true_angle_range;
double numpulse=std::min(4.52067e+10/wugrp.data_desc.true_angle_range,2.00382e+11);
double numtrip=std::min(3.25215e+12/wugrp.data_desc.true_angle_range,1.44774e+13);
// Calculate a unique key to describe this analysis config.
long keyuniq=floor(std::min(wugrp.data_desc.true_angle_range*100,1000.0)+0.5)+
s.analysis_cfg.id*1024.0;
if ((keyuniq>(13*1024)) ||(keyuniq<12*1024)) {
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Invalid keyuniq value!\n");
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%d %d %f\n",keyuniq,s.analysis_cfg.id,wugrp.data_desc.true_angle_range);
exit(1);
}
keyuniq*=-1;
//.........这里部分代码省略.........