Esempio n. 1
0
void PolyGraphic::flush () {
    GlyphIndex count = count_();
    
    for (GlyphIndex i = 0; i < count; i++) {
        Graphic31* gr = component_(i);
        concat_(gr, gr, this, gr);
        gr->flush();
    }
    Graphic31 n;
    *((Graphic31*) this) = *(&n);
}
  //----------------------------------------------------------------------
  void WS::Update(const PointProcess &data){
    // Incrementing event counts is easy...
    for(int i = 0; i < data.number_of_events(); ++i) {
      const DateTime &event(data.event(i).timestamp());
      DayNames day = event.date().day_of_week();
      int hour = event.hour();
      ++count_(day, hour);
    }

    // Increment exposure by integrating over the observation window.
    const DateTime &window_begin(data.window_begin());
    const DateTime &window_end(data.window_end());
    add_exposure_window(window_begin, window_end);
  }
  ostream & WS::print(ostream &out)const{
    out << "Counts (top) and exposure times:" << endl;
    out << setw(4) << " ";
    for(int d = 0; d < 7; ++d){
      out << setw(10) << DayNames(d);
    }
    out << endl;

    for(int h = 0; h < 24; ++h){
      out << setw(4) << std::left << h;
      for(int d = 0; d < 7; ++d){
        out << setw(10) << count_(d, h);
      }
      out << endl;

      out << setw(4) << " ";
      for(int d = 0; d < 7; ++d){
        out << setw(10) << exposure_(d, h);
      }
      out << endl;
    }
    return out;
  }
 //----------------------------------------------------------------------
 void WS::add_event(const DateTime &event){
   ++count_(event.date().day_of_week(), event.hour());
 }