double add_delta(delta const& d)
 {
     deltas.push_back(d);
     x+=d.d;
     if (tmax<d.t)
         tmax=d.t;
 }
Exemple #2
0
  void index() {
    file->seekg(0);
    line_begins.clear();
    line_begins.push_back(file->tellg());
    while (!file->eof()) {
      file->ignore(std::numeric_limits<std::streamsize>::max(), linesep); //FIXME: does setting max unsigned really work here?  not if you have very very long lines ;)  but those don't fit into memory.
      pos end = file->tellg();
      if (end > line_begins.back())
        line_begins.push_back(end);
    }
    //        should never be needed!
    Assert(file->tellg() == line_begins.back());
    /*        pos eof=file->tellg();
              if (eof > line_begins.back()) { // only necessary to handle lack of trailing newline in a friendly way
              line_begins.push_back(eof);
              }*/

    file->clear(); // don't want EOF flag stopping reads.
    line_begins.compact();
  }