ARTS  1.0.222
file.h
Go to the documentation of this file.
1 /* Copyright (C) 2000, 2001 Stefan Buehler <sbuehler@uni-bremen.de>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA. */
17 
18 
20 // File description
22 
33 #ifndef file_h
34 #define file_h
35 
36 #include <fstream>
37 #include "matpackI.h"
38 #include "mystring.h"
39 #include "absorption.h"
40 
42 // Default file names
44 
45 void filename_ascii(
46  String& filename,
47  const String& varname );
48 
50  String& filename,
51  const String& varname );
52 
53 
54 
56 // Functions to open and read ASCII files
58 
59 void open_output_file(ofstream& file, const String& name);
60 
61 void open_input_file(ifstream& file, const String& name);
62 
63 void read_text_from_stream(ArrayOfString& text, istream& is);
64 
65 void read_text_from_file(ArrayOfString& text, const String& name);
66 
67 void replace_all(String& s, const String& what, const String& with);
68 
69 
70 
72 // Matrix/Vector IO routines for ASCII files
74 
75 void write_array_of_matrix_to_stream(ostream& os,
76  const ArrayOfMatrix& am);
77 
78 void write_array_of_matrix_to_file(const String& filename,
79  const ArrayOfMatrix& am);
80 
82  istream& is);
83 
85  const String& filename);
86 
87 
88 
90 // STRING IO routines for ASCII files
92 
94  ostream& os,
95  const ArrayOfString& as );
96 
98  const String& filename,
99  const ArrayOfString& as );
100 
102  ArrayOfString& as,
103  istream& is );
104 
106  ArrayOfString& as,
107  const String& filename );
108 
110  ostream& os,
111  const TagGroups& tgs );
112 
114  const String& filename,
115  const TagGroups& tgs );
116 
117 
119 // Open and close binary
121 
123  int& fid,
124  const String& filename );
125 
127  int& fid,
128  const String& filename );
129 
131  int& fid,
132  const String& filename );
133 
134 
135 
137 // Functions to read and write binary data for ARTS data types
139 
141  const String& filename,
142  const int& fid,
143  const Index& x,
144  const String& dataname );
145 
147  Index& x,
148  const String& filename,
149  const int& fid,
150  const String& dataname );
151 
153  const String& filename,
154  const int& fid,
155  const Numeric& x,
156  const String& dataname );
157 
159  Numeric& x,
160  const String& filename,
161  const int& fid,
162  const String& dataname );
163 
165  const String& filename,
166  const int& fid,
167  const Vector& x,
168  const String& dataname );
169 
171  Vector& x,
172  const String& filename,
173  const int& fid,
174  const String& dataname );
175 
177  const String& filename,
178  const int& fid,
179  const Matrix& x,
180  const String& dataname );
181 
183  Matrix& x,
184  const String& filename,
185  const int& fid,
186  const String& dataname );
187 
189  const String& filename,
190  const int& fid,
191  const ArrayOfIndex& x,
192  const String& dataname );
193 
195  ArrayOfIndex& x,
196  const String& filename,
197  const int& fid,
198  const String& dataname );
199 
201  const String& filename,
202  const int& fid,
203  const ArrayOfVector& x,
204  const String& dataname );
205 
207  ArrayOfVector& x,
208  const String& filename,
209  const int& fid,
210  const String& dataname );
211 
213  const String& filename,
214  const int& fid,
215  const ArrayOfMatrix& x,
216  const String& dataname );
217 
219  ArrayOfMatrix& x,
220  const String& filename,
221  const int& fid,
222  const String& dataname );
223 
225  const String& filename,
226  const int& fid,
227  const String& s,
228  const String& dataname );
229 
231  String& x,
232  const String& filename,
233  const int& fid,
234  const String& dataname );
235 
237  const String& filename,
238  const int& fid,
239  const ArrayOfString& x,
240  const String& dataname );
241 
243  ArrayOfString& x,
244  const String& filename,
245  const int& fid,
246  const String& dataname );
247 
248 
249 #endif
Matrix
The Matrix class.
Definition: matpackI.h:544
open_output_file
void open_output_file(ofstream &file, const String &name)
Open a file for writing.
Definition: file.cc:91
binfile_write_vector
void binfile_write_vector(const String &filename, const int &fid, const Vector &x, const String &dataname)
replace_all
void replace_all(String &s, const String &what, const String &with)
Replace all occurances of ‘what’ in ‘s’ with ‘with’.
Definition: file.cc:242
absorption.h
Declarations required for the calculation of absorption coefficients.
binfile_write_Stringarray
void binfile_write_Stringarray(const String &filename, const int &fid, const ArrayOfString &x, const String &dataname)
write_array_of_matrix_to_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.
Definition: file.cc:268
write_array_of_matrix_to_file
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.
Definition: file.cc:322
binfile_write_vectorarray
void binfile_write_vectorarray(const String &filename, const int &fid, const ArrayOfVector &x, const String &dataname)
binfile_write_indexarray
void binfile_write_indexarray(const String &filename, const int &fid, const ArrayOfIndex &x, const String &dataname)
binfile_write_matrixarray
void binfile_write_matrixarray(const String &filename, const int &fid, const ArrayOfMatrix &x, const String &dataname)
write_array_of_String_to_file
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.
Definition: file.cc:497
binfile_close
void binfile_close(int &fid, const String &filename)
matpackI.h
Array< String >
binfile_read_matrixarray
void binfile_read_matrixarray(ArrayOfMatrix &x, const String &filename, const int &fid, const String &dataname)
binfile_read_String
void binfile_read_String(String &x, const String &filename, const int &fid, const String &dataname)
write_array_of_String_to_stream
void write_array_of_String_to_stream(ostream &os, const ArrayOfString &as)
A helper function that writes an array of String to a stream.
Definition: file.cc:469
binfile_read_index
void binfile_read_index(Index &x, const String &filename, const int &fid, const String &dataname)
binfile_read_matrix
void binfile_read_matrix(Matrix &x, const String &filename, const int &fid, const String &dataname)
filename_bin
void filename_bin(String &filename, const String &varname)
read_array_of_String_from_stream
void read_array_of_String_from_stream(ArrayOfString &as, istream &is)
A help function to read an array of String from a stream.
Definition: file.cc:522
read_text_from_stream
void read_text_from_stream(ArrayOfString &text, istream &is)
Read an ASCII stream and append the contents to the String array text.
Definition: file.cc:165
open_input_file
void open_input_file(ifstream &file, const String &name)
Open a file for reading.
Definition: file.cc:130
binfile_write_numeric
void binfile_write_numeric(const String &filename, const int &fid, const Numeric &x, const String &dataname)
my_basic_string< char >
binfile_read_Stringarray
void binfile_read_Stringarray(ArrayOfString &x, const String &filename, const int &fid, const String &dataname)
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: arts.h:147
binfile_write_matrix
void binfile_write_matrix(const String &filename, const int &fid, const Matrix &x, const String &dataname)
binfile_read_numeric
void binfile_read_numeric(Numeric &x, const String &filename, const int &fid, const String &dataname)
read_text_from_file
void read_text_from_file(ArrayOfString &text, const String &name)
Reads an ASCII file and appends the contents to the String vector text.
Definition: file.cc:206
binfile_write_index
void binfile_write_index(const String &filename, const int &fid, const Index &x, const String &dataname)
write_tag_groups_species_to_file
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.
Definition: file.cc:656
binfile_read_vector
void binfile_read_vector(Vector &x, const String &filename, const int &fid, const String &dataname)
binfile_open_in
void binfile_open_in(int &fid, const String &filename)
binfile_write_String
void binfile_write_String(const String &filename, const int &fid, const String &s, const String &dataname)
binfile_read_vectorarray
void binfile_read_vectorarray(ArrayOfVector &x, const String &filename, const int &fid, const String &dataname)
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: arts.h:153
read_array_of_matrix_from_stream
void read_array_of_matrix_from_stream(ArrayOfMatrix &am, istream &is)
A helper function that reads an array of matrix from a stream.
Definition: file.cc:371
binfile_read_indexarray
void binfile_read_indexarray(ArrayOfIndex &x, const String &filename, const int &fid, const String &dataname)
write_tag_groups_species_to_stream
void write_tag_groups_species_to_stream(ostream &os, const TagGroups &tgs)
A helper function that writes an array of String to a stream.
Definition: file.cc:621
filename_ascii
void filename_ascii(String &filename, const String &varname)
Gives the default file name for the ASCII formats.
Definition: file.cc:64
Vector
The Vector class.
Definition: matpackI.h:389
mystring.h
This file contains the definition of String, the ARTS string class.
binfile_open_out
void binfile_open_out(int &fid, const String &filename)
read_array_of_matrix_from_file
void read_array_of_matrix_from_file(ArrayOfMatrix &am, const String &filename)
A helper function that reads an array of matrix from a file.
Definition: file.cc:425
read_array_of_String_from_file
void read_array_of_String_from_file(ArrayOfString &as, const String &filename)
A help function to read an array of String from a file.
Definition: file.cc:582