Go to the documentation of this file.
98 file.exceptions(ios::badbit |
102 file.open(name.c_str() );
112 os <<
"Cannot open output file: " << name <<
'\n'
113 <<
"Maybe you don't have write access "
114 <<
"to the directory or the file?";
115 throw runtime_error(os.str());
136 file.exceptions(ios::badbit);
139 file.open(name.c_str() );
147 os <<
"Cannot open input file: " << name <<
'\n'
148 <<
"Maybe the file does not exist?";
149 throw runtime_error(os.str());
173 while (is && !is.eof())
176 getline(is,linebuffer);
179 text.push_back(linebuffer);
187 os <<
"Read Error. Last line read:\n" << linebuffer;
188 throw runtime_error(os.str());
222 catch (runtime_error x)
225 os <<
"Error reading file: " << name <<
'\n'
227 throw runtime_error(os.str());
245 while ( j != s.
npos )
248 j = (
Index)s.find(what,j+with.size());
277 case sizeof(float) : precision = FLT_DIG;
break;
278 case sizeof(double) : precision = DBL_DIG;
break;
279 default:
out0 <<
"Numeric must be double or float\n"; exit(1);
282 os <<
"# Generated by "
291 for (
Index i=0; i<n; ++i)
294 os << am[i].nrows() <<
' ' << am[i].ncols() <<
'\n';
296 os << setprecision((
int)precision);
298 for (
Index r=0; r<am[i].nrows(); ++r)
302 for (
Index c=1; c<am[i].ncols(); ++c)
304 os <<
" " << am[i](r,c);
327 out2 <<
" Writing " << filename <<
'\n';
353 getline(is,linebuffer);
355 throw runtime_error (
"Invalid character (<) in input stream.\nAre you probably trying to read an XML file?");
379 for(
Index i=0; i<n; ++i )
390 for(
Index ir=0; ir<nr; ++ir)
391 for(
Index ic=0; ic<nc; ++ic)
400 if ( is.fail() || is.bad() )
401 throw runtime_error(
"Stream gave fail or bad.");
406 throw runtime_error(
"Input finished, but end of stream not reached.");
409 out3 <<
" Dimensions:\n";
412 out3 <<
" " << am[i].nrows() <<
", " << am[i].ncols() <<
"\n";
430 out2 <<
" Reading " << filename <<
'\n';
444 catch (runtime_error x)
447 os <<
"Error reading file: " << filename <<
'\n'
449 throw runtime_error(os.str());
475 os <<
"# Generated by " <<
full_name <<
"\n";
481 for (
Index i=0; i<n; ++i)
503 out2 <<
" Writing " << filename <<
'\n';
536 getline(is,linebuffer);
551 for(
Index i=0; i<n; ++i )
558 if ( is.fail() || is.bad() )
559 throw runtime_error(
"Stream gave fail or bad.");
563 throw runtime_error(
"Input finished, but end of stream not reached.");
566 out3 <<
" Dimension: "
567 << as.
nelem() <<
", ";
588 out2 <<
" Reading " << filename <<
'\n';
602 catch (runtime_error x)
605 os <<
"Error reading file: " << filename <<
'\n'
607 throw runtime_error(os.str());
628 os <<
"# Generated by " <<
full_name <<
"\n";
634 for (
Index i=0; i<n; ++i)
636 if ( tgs[i].nelem() > 0 )
640 os << spr.
Name() <<
'\n';
662 out2 <<
" Writing " << filename <<
'\n';
Out2 out2
Level 2 output stream.
void read_array_of_matrix_from_stream(ArrayOfMatrix &am, istream &is)
A helper function that reads an array of matrix from a stream.
void write_array_of_matrix_to_file(const String &filename, const ArrayOfMatrix &am)
A helper function that writes an array of matrix to a file.
Out0 out0
Level 0 output stream.
void open_input_file(ifstream &file, const String &name)
Open a file for reading.
void write_array_of_String_to_stream(ostream &os, const ArrayOfString &as)
A helper function that writes an array of String to a stream.
void write_array_of_matrix_to_stream(ostream &os, const ArrayOfMatrix &am)
A helper function that writes an array of matrix to a stream.
This file contains the definition of Array.
This can be used to make arrays out of anything.
void read_text_from_stream(ArrayOfString &text, istream &is)
Read an ASCII stream and append the contents to the String array text.
String full_name
The ARTS running version number.
Array< SpeciesRecord > species_data
Declarations having to do with the four output streams.
The implementation for String, the ARTS string class.
void skip_comments(istream &is)
A helper function that skips lines containing comments.
NUMERIC Numeric
The type to use for all floating point numbers.
void write_tag_groups_species_to_stream(ostream &os, const TagGroups &tgs)
A helper function that writes an array of String to a stream.
void write_array_of_String_to_file(const String &filename, const ArrayOfString &as)
A help function that writes an array of String to a file.
void read_array_of_String_from_stream(ArrayOfString &as, istream &is)
A help function to read an array of String from a stream.
String out_basename
The basename for the report file and for all other output files.
void open_output_file(ofstream &file, const String &name)
Open a file for writing.
void read_array_of_String_from_file(ArrayOfString &as, const String &filename)
A help function to read an array of String from a file.
Contains the lookup data for one species.
void read_text_from_file(ArrayOfString &text, const String &name)
Reads an ASCII file and appends the contents to the String vector text.
Out3 out3
Level 3 output stream.
INDEX Index
The type to use for all integer numbers and indices.
const String & Name() const
void read_array_of_matrix_from_file(ArrayOfMatrix &am, const String &filename)
A helper function that reads an array of matrix from a file.
void filename_ascii(String &filename, const String &varname)
Gives the default file name for the ASCII formats.
This file contains basic functions to handle ASCII and binary (HDF) data files.
static const Index npos
Define npos:
void write_tag_groups_species_to_file(const String &filename, const TagGroups &tgs)
A help function that writes an array of String to a file.
Index nelem() const
Number of elements.
The global header file for ARTS.
void replace_all(String &s, const String &what, const String &with)
Replace all occurances of ‘what’ in ‘s’ with ‘with’.