Changeset 19946 for trunk/FACT++


Ignore:
Timestamp:
04/13/20 17:47:27 (5 years ago)
Author:
tbretz
Message:
Added a streaming mode which ignores the number of rows in the file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/fitsdump.cc

    r19174 r19946  
    6868private:
    6969    string fFilename;
     70    bool fStream;
    7071
    7172    // Convert CCfits::ValueType into a human readable string
     
    105106//!        the ostream where to redirect the outputs
    106107//
    107 FitsDumper::FitsDumper(const string &fname, const string &tablename) : factfits(fname, tablename), fFilename(fname)
     108FitsDumper::FitsDumper(const string &fname, const string &tablename) : factfits(fname, tablename), fFilename(fname), fStream(false)
    108109{
    109110}
     
    568569    const size_t last = limit ? first + limit : size_t(-1);
    569570
    570     while (GetRow(first++))
     571    while (GetRow(first++, !fStream))
    571572    {
    572573        const size_t row = GetRow();
    573         if (row==GetNumRows() || row==last)
     574        if ((!fStream && row==GetNumRows()) || row==last)
    574575            break;
    575576
     
    831832    const size_t last = limit ? first + limit : size_t(-1);
    832833
    833     while (GetRow(first++))
     834    while (GetRow(first++, !fStream))
    834835    {
    835836        const size_t row = GetRow();
    836         if (row==GetNumRows() || row==last)
     837        if ((!fStream && row==GetNumRows()) || row==last)
    837838            break;
    838839
     
    862863    const size_t last = limit ? first + limit : size_t(-1);
    863864
    864     while (GetRow(first++))
     865    while (GetRow(first++, !fStream))
    865866    {
    866867        const size_t row = GetRow();
    867         if (row==GetNumRows() || row==last)
     868        if ((!fStream && row==GetNumRows()) || row==last)
    868869            break;
    869870
     
    10021003    uint64_t counter = 0;
    10031004
    1004     while (GetRow(first++))
     1005    while (GetRow(first++, !fStream))
    10051006    {
    10061007        const size_t row = GetRow();
    1007         if (row==GetNumRows() || row==last)
     1008        if ((!fStream && row==GetNumRows()) || row==last)
    10081009            break;
    10091010
     
    10831084int FitsDumper::Exec(Configuration& conf)
    10841085{
     1086    fStream = conf.Get<bool>("stream");
     1087
    10851088    if (conf.Get<bool>("autocal"))
    10861089        resetCalibration();
     
    12911294        ("%,%",         vars<string>(),         "Format for the output (currently not available in root-mode)")
    12921295        ("force",       po_switch(),            "Force reading the fits file even if END key is missing")
     1296        ("stream",      po_switch(),            "Stream reading the fits file (ignore the row count in the header)")
    12931297        ("first",       var<size_t>(size_t(0)), "First number of row to read")
    12941298        ("limit",       var<size_t>(size_t(0)), "Limit for the maximum number of rows to read (0=unlimited)")
Note: See TracChangeset for help on using the changeset viewer.