Changeset 18490 for trunk/FACT++/src
- Timestamp:
- 05/06/16 10:22:08 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fitsdump.cc
r18489 r18490 85 85 86 86 ///Display the selected columns values VS time 87 void Dump(o fstream &, const vector<string> &, const vector<MyColumn> &, const string &, size_t, size_t, const string &);88 void DumpRoot(o fstream &, const vector<string> &, const string &, size_t, size_t, const string &);89 void DumpMinMax(o fstream &, const vector<MyColumn> &, size_t, size_t, bool);90 void DumpStats(o fstream &, const vector<MyColumn> &, const string &, size_t, size_t);87 void Dump(ostream &, const vector<string> &, const vector<MyColumn> &, const string &, size_t, size_t, const string &); 88 void DumpRoot(ostream &, const vector<string> &, const string &, size_t, size_t, const string &); 89 void DumpMinMax(ostream &, const vector<MyColumn> &, size_t, size_t, bool); 90 void DumpStats(ostream &, const vector<MyColumn> &, const string &, size_t, size_t); 91 91 92 92 public: … … 177 177 void FitsDumper::ListHeader(const string& filename) 178 178 { 179 ofstream fout(filename=="-"?"/dev/stdout":filename); 180 if (!fout) 181 { 182 cerr << "Cannot open output stream " << filename << ": " << strerror(errno) << endl; 183 return; 179 ostream fout(cout.rdbuf()); 180 181 ofstream sout; 182 if (filename!="-") 183 { 184 sout.open(filename); 185 if (!sout) 186 { 187 cerr << "Cannot open output stream " << filename << ": " << strerror(errno) << endl; 188 return; 189 } 190 fout.rdbuf(sout.rdbuf()); 184 191 } 185 192 … … 401 408 //! Perform the actual dump, based on the current parameters 402 409 // 403 void FitsDumper::Dump(o fstream &fout, const vector<string> &format, const vector<MyColumn> &cols, const string &filter, size_t first, size_t limit, const string &filename)410 void FitsDumper::Dump(ostream &fout, const vector<string> &format, const vector<MyColumn> &cols, const string &filter, size_t first, size_t limit, const string &filename) 404 411 { 405 412 const fits::Table::Keys &fKeyMap = GetKeys(); … … 625 632 } 626 633 627 void FitsDumper::DumpRoot(o fstream &fout, const vector<string> &cols, const string &filter, size_t first, size_t limit, const string &filename)634 void FitsDumper::DumpRoot(ostream &fout, const vector<string> &cols, const string &filter, size_t first, size_t limit, const string &filename) 628 635 { 629 636 #ifdef HAVE_ROOT … … 715 722 } 716 723 717 void FitsDumper::DumpMinMax(o fstream &fout, const vector<MyColumn> &cols, size_t first, size_t limit, bool fNoZeroPlease)724 void FitsDumper::DumpMinMax(ostream &fout, const vector<MyColumn> &cols, size_t first, size_t limit, bool fNoZeroPlease) 718 725 { 719 726 vector<minMaxStruct> statData(cols.size()); … … 789 796 790 797 template<typename T> 791 void displayStats(vector<char> &array, o fstream& out)798 void displayStats(vector<char> &array, ostream& out) 792 799 { 793 800 const size_t numElems = array.size()/sizeof(T); … … 829 836 } 830 837 831 void FitsDumper::DumpStats(o fstream &fout, const vector<MyColumn> &cols, const string &filter, size_t first, size_t limit)838 void FitsDumper::DumpStats(ostream &fout, const vector<MyColumn> &cols, const string &filter, size_t first, size_t limit) 832 839 { 833 840 #ifdef HAVE_ROOT … … 981 988 const string filename = conf.Get<string>("outfile"); 982 989 983 ofstream fout(filename=="-"?"/dev/stdout":filename); 984 if (!fout) 985 { 986 cerr << "Cannot open output stream " << filename << ": " << strerror(errno) << endl; 987 return false; 988 } 990 ostream fout(cout.rdbuf()); 991 992 ofstream sout; 993 if (filename!="-") 994 { 995 sout.open(filename); 996 if (!sout) 997 { 998 cerr << "Cannot open output stream " << filename << ": " << strerror(errno) << endl; 999 return false; 1000 } 1001 fout.rdbuf(sout.rdbuf()); 1002 } 1003 989 1004 fout.precision(conf.Get<int>("precision")); 990 1005 if (conf.Get<bool>("fixed"))
Note:
See TracChangeset
for help on using the changeset viewer.