PRSet TRSet::LoadBin(const TStr& FNm, const bool& MultiRSetsP){ if (!MultiRSetsP){ TFIn SIn(FNm); return Load(SIn); } else { PRSet RSet=TRSet::New(); TFIn SIn(FNm); int RSets=0; while (!SIn.Eof()){ RSets++; //printf("%d\r", RSets); PRSet SubRSet=TRSet::Load(SIn); RSet->Merge(SubRSet); } return RSet; } }
int main(int argc, char** argv){ TTableContext Context; if (argc < 2){ printf("Usage: %s <srcfile>\n", argv[0]); } char* srcfile = argv[1]; timeval tim; gettimeofday(&tim, NULL); double t1=tim.tv_sec+(tim.tv_usec/1000000.0); TFIn SIn(srcfile); PTable T1 = TTable::Load(SIn, Context); gettimeofday(&tim, NULL); double t2=tim.tv_sec+(tim.tv_usec/1000000.0); printf("Load time: %f\n", t2-t1); PTable T2 = TTable::New("2", T1->GetSchema(), Context); gettimeofday(&tim, NULL); double t3=tim.tv_sec+(tim.tv_usec/1000000.0); T1->SelectAtomicIntConst("Src", 10000, LT, T2); gettimeofday(&tim, NULL); double t4=tim.tv_sec+(tim.tv_usec/1000000.0); printf("Select time: %f\n", t4-t3); return 0; }
void TRSet::LoadRSetsBin(const TStr& FNm, TRSetV& RSetV){ TFIn SIn(FNm); RSetV.Clr(); int RSets=0; while (!SIn.Eof()){ RSets++; printf("%d\r", RSets); PRSet RSet=TRSet::Load(SIn); RSetV.Add(RSet); } }
void TGgSchRSet::LoadRSetsBin(const TStr& FNm, TGgSchRSetV& RSetV){ TFIn SIn(FNm); RSetV.Clr(); int RSets=0; while (!SIn.Eof()){ RSets++; if (RSets%100==0){printf("%d\r", RSets);} PGgSchRSet RSet(SIn); RSetV.Add(RSet); } }
void TSkyGridBinDoc::LoadBinDocV(const TStr& InBinFNm){ printf("Processing SkyGrid News-Binary file '%s'...\n", InBinFNm.CStr()); TFIn SIn(InBinFNm); int Docs=0; while (!SIn.Eof()){ TSkyGridBinDoc Doc(SIn); Docs++; printf("%d\r", Docs); } printf("\nDone.\n"); }
void SamplingToSRAM(unsigned char blocks) { unsigned char rec_chr,i; rec_chr=0; dac_index=0; if (DAC0_mode) { SFRPAGE = DAC0_PAGE; DAC0CN = 0x9C; // left justified, update on Timer2 overflow } SFRPAGE = TMR2_PAGE; TMR2CN = 0x00; ADC_Init(1); SFRPAGE = ADC0_PAGE; AD0INT=0; SFRPAGE = ADC1_PAGE; AD1INT=0; fifo_wp=fifo_rp=0; samples_to_save=fifo_size; fifo_blocks=0; fifo_max_blocks=blocks; fifo_mode=0; dac_index=0; LED=0; SFRPAGE = TMR4_PAGE; TMR4CN = 0x04; TMR4CF = 0x08; SFRPAGE=CONFIG_PAGE; P4_5=0; // enable SRAM EA=1; SFRPAGE = TMR2_PAGE; TMR2CN = 0x04; while (EA); // wait for end of sampling do { rec_chr=SIn(); for(i=0; i<fifo_size; i++) { SOut(fifo[fifo_rp++]); SOut(fifo[fifo_rp++]); } } while ( (rec_chr!=27) && (fifo_rp<fifo_wp) ); SFRPAGE=CONFIG_PAGE; P4_5=1; // disable SRAM EA=0; SFRPAGE = TMR2_PAGE; TMR2CN = 0x00; LED=1; SFRPAGE = DAC0_PAGE; DAC0CN = 0x84; }
/// Load main file void TPgBlob::LoadMain() { TFIn SIn(FNm + ".main"); TInt children_cnt; children_cnt.Load(SIn); Fsm.Load(SIn); Files.Clr(); for (int i = 0; i < children_cnt; i++) { TStr FNmChild = FNm + ".bin" + TStr::GetNrNumFExt(i); Files.Add(TPgBlobFile::New(FNmChild, Access, MxBlobFLen)); } }
void SendID() { unsigned char *s; s="EduDAQ (c) 02/05/2009 www.noise.physx.u-szeged.hu"; do { if (SIn()==27) break; SOut(*s); if (*s) s++; } while (*s); }
PGeoIpBs TGeoIpBs::LoadBin(const TStr& FNm){ // load and return if exists if (TFile::Exists(FNm)) { TFIn SIn(FNm); return Load(SIn); } // otherwise assume we have CSV and we need to parse it first printf("Cannot fine %s, loading from raw files\n", FNm.CStr()); TStr FPath = FNm.GetFPath() + "/GeoIP/"; PGeoIpBs GeoIpBs = LoadCsv(FPath); GeoIpBs->SaveBin(FNm); return GeoIpBs; }
void SendID() { unsigned char *s; s="MA-DAQ (c) 11/11/2011 www.inf.u-szeged.hu/noise"; do { if (SIn()==27) break; SOut(*s); if (*s) s++; } while (*s); }
PBowMd TBowMd::LoadBin(const TStr& FNm, const PBowDocBs& BowDocBs){ PBowMd BowMd; {TFIn SIn(FNm); BowMd=Load(SIn);} if ((!BowDocBs.Empty())&&(BowMd->GetBowDocBsSig()!=BowDocBs->GetSig())){ TExcept::Throw("Bow-Model and Bow-Data signatures don't match!");} return BowMd; }