250 out2 <<
" Reading " + filename +
'\n';
253 std::unique_ptr<istream> ifs;
254 if (filename.
nelem() > 2 &&
255 filename.substr(filename.length() - 3, 3) ==
".gz")
258 ifs = std::make_unique<igzstream>();
260 *
static_cast<igzstream*
>(ifs.get()), filename, verbosity);
265 "This arts version was compiled without zlib support.\n"
266 "Thus zipped xml files cannot be read.");
270 ifs = std::make_unique<ifstream>();
272 *
static_cast<ifstream*
>(ifs.get()), filename, verbosity);
290 String bfilename = filename +
".bin";
295 }
catch (
const std::runtime_error& e) {
297 os <<
"Error reading file: " << filename <<
'\n' << e.what();
298 throw runtime_error(os.str());
319 std::unique_ptr<ostream> ofs;
321 out2 <<
" Writing " << filename <<
'\n';
325 ofs = std::make_unique<ogzstream>();
331 "This arts version was compiled without zlib support.\n"
332 "Thus zipped xml files cannot be written.");
336 ofs = std::make_unique<ofstream>();
345 String bfilename = filename +
".bin";
351 }
catch (
const std::runtime_error& e) {
353 os <<
"Error writing file: " << filename <<
'\n' << e.what();
354 throw runtime_error(os.str());
The global header file for ARTS.
This can be used to make arrays out of anything.
bool has_attribute(const String &aname) const
Returns if the attribute exists or not.
void add_attribute(const String &aname, String value)
void write_to_stream(ostream &os)
Write XML tag.
void check_name(const String &expected_name)
Check tag name.
XMLTag(const Verbosity &rverbosity)
void read_from_stream(istream &is)
Reads next XML tag.
Array< XMLAttribute > attribs
void get_attribute_value(const String &aname, String &value)
void set_name(const String &new_name)
void check_attribute(const String &aname, const String &value)
Checks whether attribute has the expected value.
const Verbosity & verbosity
Binary output file stream class.
Binary output file stream class.
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
void xml_write_to_stream(ostream &os_xml, const ArrayOfAgenda &aa, bofstream *pbofs, const String &name, const Verbosity &)
Writes ArrayOfAgenda to XML output stream.
void xml_read_from_stream(istream &is_xml, ArrayOfAgenda &aa, bifstream *pbifs, const Verbosity &)
Reads ArrayOfAgenda from XML input stream.
void xml_write_footer_to_stream(ostream &os, const Verbosity &verbosity)
Write closing root tag.
void xml_data_parse_error(XMLTag &tag, const String &str_error)
Throws XML parser runtime error.
void xml_open_input_file(ifstream &ifs, const String &name, const Verbosity &verbosity)
Open file for XML input.
void xml_write_to_file_base(const String &filename, const T &type, const FileType ftype, const Verbosity &verbosity)
Write data to XML file.
void xml_parse_from_stream(istream &, Vector &, bifstream *, XMLTag &, const Verbosity &verbosity)
Parses Vector from XML input stream.
void xml_read_footer_from_stream(istream &is, const Verbosity &verbosity)
Reads closing root tag.
void parse_xml_tag_content_as_string(std::istream &is_xml, String &content)
Get the content of an xml tag as a string.
void xml_read_header_from_stream(istream &is, FileType &ftype, NumericType &ntype, EndianType &etype, const Verbosity &verbosity)
Reads XML header and root tag.
void xml_write_header_to_stream(ostream &os, FileType ftype, const Verbosity &verbosity)
Writes XML header and root tag.
void xml_set_stream_precision(ostream &os)
FileType string2filetype(const String &file_format)
void xml_open_output_file(ofstream &file, const String &name)
Open file for XML output.
void xml_read_from_file_base(const String &filename, T &type, const Verbosity &verbosity)
Reads data from XML file.
void xml_parse_error(const String &str_error)
Throws XML parser runtime error.