#include "arts.h"
#include "xml_io.h"
#include "xml_io_private.h"
#include "xml_io_types.h"
#include "xml_io_instantiation.h"
#include "bofstream.h"
#include "bifstream.h"
#include "file.h"
Go to the source code of this file.
Functions | |
void | filename_xml (String &filename, const String &varname) |
Gives the default filename for the XML formats. | |
void | filename_xml_with_index (String &filename, const Index &file_index, const String &varname) |
Gives the default filename, with file index, for the XML formats. | |
void | xml_open_output_file (ofstream &file, const String &name) |
Open file for XML output. | |
void | xml_open_input_file (ifstream &ifs, const String &name) |
Open file for XML input. | |
void | xml_parse_error (const String &str_error) |
Throws XML parser runtime error. | |
void | xml_data_parse_error (ArtsXMLTag &tag, String str_error) |
Throws XML parser runtime error. | |
void | xml_read_header_from_stream (istream &is, FileType &ftype, NumericType &ntype, EndianType &etype) |
Reads XML header and root tag. | |
void | xml_read_footer_from_stream (istream &is) |
Reads closing root tag. | |
void | xml_write_header_to_stream (ostream &os, FileType ftype) |
Writes XML header and root tag. | |
void | xml_write_footer_to_stream (ostream &os) |
Write closing root tag. | |
void | xml_set_stream_precision (ostream &os) |
template<typename T> | |
void | xml_read_from_file (const String &filename, T &type) |
Reads data from XML file. | |
void | xml_read_arts_catalogue_from_file (const String &filename, ArrayOfLineRecord &type, const Numeric &fmin, const Numeric &fmax) |
template<typename T> | |
void | xml_write_to_file (const String &filename, const T &type, const FileType ftype) |
Write data to XML file. |
Definition in file xml_io.cc.
Gives the default filename for the XML formats.
The default name is only used if the filename is empty.
filename | filename | |
varname | variable name |
Definition at line 362 of file xml_io.cc.
References out_basename.
Referenced by Cloudbox_ppath_rteCalc(), ReadXML(), and WriteXML().
void filename_xml_with_index | ( | String & | filename, | |
const Index & | file_index, | |||
const String & | varname | |||
) |
Gives the default filename, with file index, for the XML formats.
The default name is only used if the filename is empty.
[out] | filename | filename |
[in] | file_index | Index appended to the filename |
[in] | varname | variable name |
Definition at line 383 of file xml_io.cc.
References out_basename.
Referenced by WriteXMLIndexed().
void xml_data_parse_error | ( | ArtsXMLTag & | tag, | |
String | str_error | |||
) |
Throws XML parser runtime error.
This is used quite often inside the data parsing routines so it's a function for itself.
tag | ArtsXMLTag | |
str_error | Error description |
Definition at line 635 of file xml_io.cc.
References ArtsXMLTag::write_to_stream().
Referenced by xml_parse_from_stream(), and xml_read_from_stream().
void xml_open_input_file | ( | ifstream & | ifs, | |
const String & | name | |||
) |
Open file for XML input.
This function opens an XML file for reading.
ifs | Input filestream | |
name | Filename |
Definition at line 521 of file xml_io.cc.
References out3.
Referenced by xml_read_arts_catalogue_from_file(), and xml_read_from_file().
void xml_open_output_file | ( | ofstream & | file, | |
const String & | name | |||
) |
Open file for XML output.
This function opens an XML file for writing.
file | Output filestream | |
name | Filename |
Definition at line 420 of file xml_io.cc.
Referenced by xml_write_to_file().
void xml_parse_error | ( | const String & | str_error | ) |
Throws XML parser runtime error.
This is used quite often inside the parsing routines so it's a function for itself.
str_error | Error description |
Definition at line 617 of file xml_io.cc.
Referenced by ArtsXMLTag::check_attribute(), ArtsXMLTag::check_name(), ArtsXMLTag::get_attribute_value(), ArtsXMLTag::read_from_stream(), xml_read_from_stream(), and xml_read_header_from_stream().
void xml_read_arts_catalogue_from_file | ( | const String & | filename, | |
ArrayOfLineRecord & | type, | |||
const Numeric & | fmin, | |||
const Numeric & | fmax | |||
) |
Definition at line 919 of file xml_io.cc.
References FILE_TYPE_ASCII, find_file(), out2, xml_open_input_file(), xml_read_footer_from_stream(), xml_read_from_stream(), and xml_read_header_from_stream().
Referenced by abs_linesReadFromArts().
void xml_read_footer_from_stream | ( | istream & | is | ) |
Reads closing root tag.
Checks whether XML file ends correctly with </arts>.
is | Input stream |
Definition at line 756 of file xml_io.cc.
References ArtsXMLTag::check_name(), and ArtsXMLTag::read_from_stream().
Referenced by xml_read_arts_catalogue_from_file(), and xml_read_from_file().
void xml_read_from_file | ( | const String & | filename, | |
T & | type | |||
) | [inline] |
Reads data from XML file.
This is a generic functions that is used to read the XML header and footer info and calls the overloaded functions to read the data.
filename | XML filename | |
type | Generic return value |
Definition at line 847 of file xml_io.cc.
References FILE_TYPE_ASCII, find_file(), out2, xml_open_input_file(), xml_read_footer_from_stream(), xml_read_from_stream(), and xml_read_header_from_stream().
Referenced by AtmRawRead(), DoitAngularGridsSet(), magfield_nk(), main(), ParticleTypeAdd(), ParticleTypeAddAll(), ReadXML(), test45(), test46(), ybatchMetProfiles(), and ybatchMetProfilesClear().
void xml_read_header_from_stream | ( | istream & | is, | |
FileType & | ftype, | |||
NumericType & | ntype, | |||
EndianType & | etype | |||
) |
Reads XML header and root tag.
Check whether XML file has correct version tag and reads arts root tag information.
is | Input stream | |
ftype | File type | |
ntype | Numeric type | |
etype | Endian type |
Definition at line 658 of file xml_io.cc.
References ArtsXMLTag::check_name(), ENDIAN_TYPE_BIG, ENDIAN_TYPE_LITTLE, FILE_TYPE_ASCII, FILE_TYPE_BINARY, ArtsXMLTag::get_attribute_value(), NUMERIC_TYPE_DOUBLE, NUMERIC_TYPE_FLOAT, ArtsXMLTag::read_from_stream(), and xml_parse_error().
Referenced by xml_read_arts_catalogue_from_file(), and xml_read_from_file().
void xml_set_stream_precision | ( | ostream & | os | ) |
Definition at line 815 of file xml_io.cc.
References precision.
Referenced by xml_write_to_stream().
void xml_write_footer_to_stream | ( | ostream & | os | ) |
Write closing root tag.
os | Output stream |
Definition at line 804 of file xml_io.cc.
References ArtsXMLTag::set_name(), and ArtsXMLTag::write_to_stream().
Referenced by xml_write_to_file().
void xml_write_header_to_stream | ( | ostream & | os, | |
FileType | ftype | |||
) |
Writes XML header and root tag.
os | Output stream | |
ftype | File type |
Definition at line 771 of file xml_io.cc.
References ArtsXMLTag::add_attribute(), FILE_TYPE_ASCII, FILE_TYPE_BINARY, FILE_TYPE_ZIPPED_ASCII, ArtsXMLTag::set_name(), and ArtsXMLTag::write_to_stream().
Referenced by xml_write_to_file().
void xml_write_to_file | ( | const String & | filename, | |
const T & | type, | |||
const FileType | ftype | |||
) | [inline] |
Write data to XML file.
This is a generic functions that is used to write the XML header and footer info and calls the overloaded functions to write the data.
filename | XML filename | |
type | Generic input value | |
ftype | File type |
Definition at line 1002 of file xml_io.cc.
References FILE_TYPE_ASCII, FILE_TYPE_ZIPPED_ASCII, out2, xml_open_output_file(), xml_write_footer_to_stream(), xml_write_header_to_stream(), and xml_write_to_stream().
Referenced by Cloudbox_ppath_rteCalc(), DoitWriteIterationFields(), main(), scat_data_rawCheck(), test45(), test46(), WriteXML(), and ybatchMetProfilesClear().