ifbProcBase Class Reference

Inheritance diagram for ifbProcBase:
ifbProcRoto

List of all members.

Public Member Functions

 ifbProcBase (ifbConfig cfgIn)
virtual ~ifbProcBase ()
virtual int Init ()
virtual int SpillInit (double when)
virtual int SpillDevice (double when, std::string device)
virtual int SpillFinish (double when)
virtual int Finish ()
virtual int NewCache (double cacheStart)
virtual int ScanWindow (double t1, double t2)
virtual int ProcessTime (double when)
virtual int Run ()
size_t SpillCount ()

Protected Attributes

BeamFolder * bf
ifbConfig cfg
size_t nspills
std::vector< double > cacheTimes
std::vector< std::string > cacheDevices

Detailed Description

Definition at line 87 of file ifbtorr.cc.


Constructor & Destructor Documentation

ifbProcBase::ifbProcBase ( ifbConfig  cfgIn  ) 

Definition at line 546 of file ifbtorr.cc.

References bf, ifbConfig::BundleName, ifbConfig::CacheWindow, cfg, ifbConfig::Epsilon, and ifbConfig::URLifbeam.

00547   : bf(0), cfg(cfgIn), nspills(0) 
00548 {
00549   //
00550   // Create the BeamFolder w/ default [1200 sec] window
00551   // this will be less than the total window we want to scan (in general)
00552   // but we'll just push the BeamFolder cache window along
00553   //
00554   if ( cfg.CacheWindow > 1.0 ) {
00555     bf = new BeamFolder(cfg.BundleName, cfg.URLifbeam, cfg.CacheWindow); 
00556   } else {
00557     bf = new BeamFolder(cfg.BundleName, cfg.URLifbeam); 
00558   }
00559   bf->set_epsilon(cfg.Epsilon);  // matching criteria (?)
00560 }

virtual ifbProcBase::~ifbProcBase (  )  [inline, virtual]

Definition at line 90 of file ifbtorr.cc.

00090 { ; }


Member Function Documentation

int ifbProcBase::Finish (  )  [virtual]

Reimplemented in ifbProcRoto.

Definition at line 578 of file ifbtorr.cc.

Referenced by Run().

00579 {
00580   return 0;
00581 }

int ifbProcBase::Init ( void   )  [virtual]

Reimplemented in ifbProcRoto.

Definition at line 562 of file ifbtorr.cc.

Referenced by Run().

00563 { 
00564   return 0;
00565 }

int ifbProcBase::NewCache ( double  cacheStart  )  [virtual]

Definition at line 582 of file ifbtorr.cc.

References bf, cacheDevices, cacheTimes, ifbConfig::CacheWindow, cfg, exename, UniqueNames(), and ifbConfig::Verbose.

Referenced by ScanWindow().

00583 {
00584   cacheTimes.clear();
00585   cacheDevices.clear();
00586 
00587   try {
00588     bf->FillCache(cacheStart);
00589     cacheTimes = bf->GetTimeList();
00590     std::sort(cacheTimes.begin(),cacheTimes.end()); // ensure time ordered
00591     cacheDevices = UniqueNames( bf->GetDeviceList(), cfg.Verbose );
00592   } catch(WebAPIException we) {
00593     if ( cfg.Verbose > 0 ) {
00594       std::cout << exename << ": no spills in BeamFolder cache " 
00595                 << std::fixed << std::setprecision(3) << cacheStart;
00596       if ( cfg.CacheWindow > 1 ) {
00597         std::cout << " (+ " << cfg.CacheWindow << ")";
00598       } else {
00599         std::cout << " (+ default BeamFolder window " << 1200 << "?)";
00600       }
00601       std::cout << std::endl;
00602     }
00603   }
00604   return 0;
00605 }

int ifbProcBase::ProcessTime ( double  when  )  [virtual]

Definition at line 630 of file ifbtorr.cc.

References cacheDevices, SpillDevice(), SpillFinish(), and SpillInit().

Referenced by ScanWindow().

00631 {
00632   SpillInit(t);
00633   for (size_t idevice=0; idevice < cacheDevices.size(); ++idevice) {
00634     std::string devname = cacheDevices[idevice];
00635     SpillDevice(t,devname);
00636   }
00637   SpillFinish(t);
00638   return 0;
00639 }

int ifbProcBase::Run (  )  [virtual]

Definition at line 640 of file ifbtorr.cc.

References cfg, exename, exit(), Finish(), Init(), nspills, ifbConfig::PrintConfig(), ifbConfig::PrintOpts, ScanWindow(), ifbConfig::TimeStamp, and ifbConfig::WindowSize.

Referenced by main().

00641 {
00642   int istat_init = Init();
00643   if ( istat_init != 0 ) {
00644     cfg.PrintConfig();
00645     std::cout << exename << ": init config returned " << istat_init
00646               << std::endl;
00647     exit(istat_init);
00648   }
00649 
00650   double t1 = cfg.TimeStamp;
00651   double t2 = t1 + cfg.WindowSize;
00652   int istat_scan = ScanWindow( t1, t2 );
00653   if ( istat_scan != 0 ) {
00654     cfg.PrintConfig();
00655     std::cout << exename << ": scan returned " << istat_scan
00656               << std::endl;
00657     exit(istat_scan);
00658   }
00659 
00660   int istat_finish = Finish();
00661   if ( istat_finish != 0 ) {
00662     cfg.PrintConfig();
00663     std::cout << exename << ": Finish() returned " << istat_init
00664               << std::endl;
00665     exit(istat_init);
00666   }
00667  
00668   if ( cfg.PrintOpts.find("spillcnt") != std::string::npos ) {
00669     std::cout << exename << ": saw " << nspills << " spills" << std::endl;
00670   }
00671   return 0;
00672 }

int ifbProcBase::ScanWindow ( double  t1,
double  t2 
) [virtual]

Definition at line 606 of file ifbtorr.cc.

References bf, cacheTimes, cfg, ifbConfig::DeltaCacheTime, it, NewCache(), nspills, ifbConfig::PrintOpts, ProcessTime(), and UTCTimeString().

Referenced by Run().

00607 {
00608   bool printTime = ( cfg.PrintOpts.find("times") != std::string::npos );
00609 
00610   double tCache = t1;
00611   while ( tCache < t2 ) {
00612     NewCache( tCache );  // take a new BeamFolder cached time segment
00613     for (size_t it=0; it < cacheTimes.size(); ++it) {
00614       double t = cacheTimes[it];
00615       if ( t < t2 ) {
00616         if ( printTime ) {
00617           std::cout << "   [" << std::setw(6) << nspills << "] "
00618                     << std::fixed << std::setprecision(3) << t 
00619                     << " = " << UTCTimeString(t) << std::endl;
00620         }
00621         ++nspills;
00622         ProcessTime(t);
00623       }
00624     }
00625     // slide BeamFolder cache on to next time segment
00626     tCache = bf->GetCacheEndTime() + cfg.DeltaCacheTime;
00627   }
00628   return 0;
00629 }

size_t ifbProcBase::SpillCount (  )  [inline]

Definition at line 105 of file ifbtorr.cc.

References nspills.

00105 { return nspills; }

int ifbProcBase::SpillDevice ( double  when,
std::string  device 
) [virtual]

Reimplemented in ifbProcRoto.

Definition at line 570 of file ifbtorr.cc.

Referenced by ProcessTime().

00571 {
00572   return 0;
00573 }

int ifbProcBase::SpillFinish ( double  when  )  [virtual]

Reimplemented in ifbProcRoto.

Definition at line 574 of file ifbtorr.cc.

Referenced by ProcessTime().

00575 {
00576   return 0;
00577 }

int ifbProcBase::SpillInit ( double  when  )  [virtual]

Reimplemented in ifbProcRoto.

Definition at line 566 of file ifbtorr.cc.

Referenced by ProcessTime().

00567 {
00568   return 0;
00569 }


Member Data Documentation

BeamFolder* ifbProcBase::bf [protected]

Definition at line 108 of file ifbtorr.cc.

Referenced by ifbProcBase(), NewCache(), ScanWindow(), and ifbProcRoto::SpillDevice().

std::vector<std::string> ifbProcBase::cacheDevices [protected]

Definition at line 114 of file ifbtorr.cc.

Referenced by NewCache(), and ProcessTime().

std::vector<double> ifbProcBase::cacheTimes [protected]

Definition at line 113 of file ifbtorr.cc.

Referenced by NewCache(), and ScanWindow().

size_t ifbProcBase::nspills [protected]

Definition at line 110 of file ifbtorr.cc.

Referenced by ifbProcRoto::Finish(), Run(), ScanWindow(), SpillCount(), and ifbProcRoto::SpillInit().


The documentation for this class was generated from the following file:

Generated on 24 Jul 2018 for loon by  doxygen 1.6.1