Changeset 17777 for trunk


Ignore:
Timestamp:
05/05/14 09:44:50 (10 years ago)
Author:
tbretz
Message:
Solved the problem that so far cint does not define __MARS__; added an option to PrintKeys; remove all reserved keywords from the list of printed keys; some minor code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mcore/fits.h

    r17750 r17777  
    2323#endif
    2424
    25 #ifndef __MARS__
     25#if defined(__MARS__) || defined(__CINT__)
     26#include "MLog.h"
     27#include "MLogManip.h"
     28#define ___err___   err
     29#define ___warn___  warn
     30#define ___all___   all
     31#else
    2632#include <vector>
    2733#include <iomanip>
     
    3339#define ___all___   ""
    3440#endif
    35 #else
    36 #include "MLog.h"
    37 #include "MLogManip.h"
    38 #define ___err___   err
    39 #define ___warn___  warn
    40 #define ___all___   all
    4141#endif
    4242
     
    4949#endif
    5050
     51#include "FITS.h"
    5152#include "checksum.h"
    5253
     
    171172        Keys ParseBlock(const std::vector<std::string> &vec) const
    172173        {
    173             std::map<std::string,Entry> rc;
     174            Keys rc;
    174175
    175176            for (unsigned int i=0; i<vec.size(); i++)
     
    203204                    // Set value, comment and type
    204205                    // comments could be just spaces. take care of this.
    205                     if (ppp!=std::string::npos && val.size() != ppp+1)
     206                    if (ppp!=std::string::npos && val.size()!=ppp+1)
    206207                        com = Trim(val.substr(ppp+1));
    207208
     
    213214                    const size_t p = val.find_first_of('/');
    214215
    215                     if (val.size() != p+1)
     216                    if (p!=std::string::npos && val.size()!=p+1)
    216217                        com = Trim(val.substr(p+2));
    217218
     
    265266            num_rows      = is_compressed ? Get<size_t>("ZNAXIS2") : Get<size_t>("NAXIS2");
    266267            num_cols      = Get<size_t>("TFIELDS");
    267             datasum       = is_compressed ? Get<int64_t>("DATASUM", -1) : Get<int64_t>("DATASUM", -1);
    268 //cout << "IS COMPRESSED =-========= " << is_compressed << " " << Get<size_t>("NAXIS1") << endl;
     268            datasum       = Get<int64_t>("DATASUM", -1);
    269269            size_t bytes = 0;
    270270
     
    329329
    330330                cols[id] = col;
    331                 sorted_cols.push_back(col);
     331                sorted_cols.emplace_back(col);
    332332                bytes  += n*size;
    333333            }
     
    353353            for (Keys::const_iterator it=keys.cbegin(); it!=keys.cend(); it++)
    354354            {
    355                 if (!display_all &&
    356                     (it->first.substr(0, 6)=="TTYPE" ||
    357                      it->first.substr(0, 6)=="TFORM" ||
    358                      it->first.substr(0, 6)=="TUNIT" ||
    359                      it->first=="TFIELDS"  ||
    360                      it->first=="XTENSION" ||
    361                      it->first=="NAXIS"    ||
    362                      it->first=="BITPIX"   ||
    363                      it->first=="PCOUNT"   ||
    364                      it->first=="GCOUNT")
    365                    )
     355                if (!display_all && FITS::IsReservedKeyWord(it->first))
    366356                    continue;
    367357
    368358                gLog << ___all___ << std::setw(2) << it->second.type << '|' << it->first << '=' << it->second.value << '/' << it->second.comment << '|' << std::endl;
    369             }}
     359            }
     360        }
    370361
    371362        void PrintColumns() const
     
    423414            T Get(const std::string &key) const
    424415        {
    425             const std::map<std::string,Entry>::const_iterator it = keys.find(key);
     416            const Keys::const_iterator it = keys.find(key);
    426417            if (it==keys.end())
    427418            {
     
    442433            T Get(const std::string &key, const T &deflt) const
    443434        {
    444             const std::map<std::string,Entry>::const_iterator it = keys.find(key);
     435            const Keys::const_iterator it = keys.find(key);
    445436            return it==keys.end() ? deflt :it->second.Get<T>();
    446437        }
     
    543534            }
    544535
    545             vec.push_back(str);
     536            vec.emplace_back(str);
    546537        }
    547538
     
    10231014    operator bool() const { return fTable && fTable.offset!=0; }
    10241015
    1025     void PrintKeys() const { fTable.PrintKeys(); }
     1016    void PrintKeys(bool all_keys=false) const { fTable.PrintKeys(all_keys); }
    10261017    void PrintColumns() const { fTable.PrintColumns(); }
    10271018
Note: See TracChangeset for help on using the changeset viewer.