233 out2 <<
" Reading " + filename +
'\n';
236 std::unique_ptr<istream> ifs;
237 if (filename.
nelem() > 2 &&
238 filename.substr(filename.length() - 3, 3) ==
".gz")
241 ifs = std::make_unique<igzstream>();
243 *
static_cast<igzstream*
>(ifs.get()), filename, verbosity);
248 "This arts version was compiled without zlib support.\n"
249 "Thus zipped xml files cannot be read.");
253 ifs = std::make_unique<ifstream>();
255 *
static_cast<ifstream*
>(ifs.get()), filename, verbosity);
273 String bfilename = filename +
".bin";
278 }
catch (
const std::runtime_error& e) {
280 os <<
"Error reading file: " << filename <<
'\n' << e.what();
281 throw runtime_error(os.str());
302 std::unique_ptr<ostream> ofs;
304 out2 <<
" Writing " << filename <<
'\n';
308 ofs = std::make_unique<ogzstream>();
314 "This arts version was compiled without zlib support.\n"
315 "Thus zipped xml files cannot be written.");
319 ofs = std::make_unique<ofstream>();
328 String bfilename = filename +
".bin";
334 }
catch (
const std::runtime_error& e) {
336 os <<
"Error writing file: " << filename <<
'\n' << e.what();
337 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.
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.