56 it_error(
"it_ifile::open(): Corrupt file (not an it_file)");
80 if (
h.type !=
"" &&
h.name == name) {
84 s.
seekg(p +
static_cast<std::streamoff
>(
h.block_bytes));
97 for (
int i = 0;
i <= n;
i++) {
106 s.
seekg((
i == n) ? p : p +
static_cast<std::streamoff
>(
h.block_bytes));
129 s.
read(
reinterpret_cast<char *
>(&
h),
sizeof(
h));
159 x = (
tmp == 0) ?
false :
true;
216 for (
int i = 0;
i <
v.
size(); ++
i) {
228 for (
int i = 0;
i <
v.
size(); ++
i) {
240 for (
int i = 0;
i <
v.
size(); ++
i) {
252 for (
int i = 0;
i <
v.
size(); ++
i) {
254 v(
i) =
static_cast<double>(
val);
273 for (
int i = 0;
i <
v.
size(); ++
i) {
286 for (
int i = 0;
i <
v.
size(); ++
i) {
297 std::string::size_type
size2 =
static_cast<std::string::size_type
>(
size);
299 for (std::string::size_type
i = 0;
i <
size2; ++
i)
308 m.
set_size(
static_cast<int>(
i),
static_cast<int>(
j),
false);
309 for (
int j = 0;
j < m.cols(); ++
j) {
310 for (
int i = 0;
i < m.rows(); ++
i) {
322 m.
set_size(
static_cast<int>(
i),
static_cast<int>(
j),
false);
323 for (
int j = 0;
j < m.cols(); ++
j)
324 for (
int i = 0;
i < m.rows(); ++
i) {
335 m.
set_size(
static_cast<int>(
i),
static_cast<int>(
j),
false);
336 for (
int j = 0;
j < m.cols(); ++
j)
337 for (
int i = 0;
i < m.rows(); ++
i) {
348 m.
set_size(
static_cast<int>(
i),
static_cast<int>(
j),
false);
349 for (
int j = 0;
j < m.cols(); ++
j)
350 for (
int i = 0;
i < m.rows(); ++
i) {
352 m(
i,
j) =
static_cast<double>(
val);
360 m.
set_size(
static_cast<int>(
i),
static_cast<int>(
j),
false);
361 for (
int j = 0;
j < m.cols(); ++
j)
362 for (
int i = 0;
i < m.rows(); ++
i)
371 m.
set_size(
static_cast<int>(
i),
static_cast<int>(
j),
false);
372 for (
int j = 0;
j < m.cols(); ++
j)
373 for (
int i = 0;
i < m.rows(); ++
i) {
385 m.
set_size(
static_cast<int>(
i),
static_cast<int>(
j),
false);
386 for (
int j = 0;
j < m.cols(); ++
j)
387 for (
int i = 0;
i < m.rows(); ++
i) {
400 for (
int i = 0;
i <
v.
size(); ++
i) {
412 for (
int i = 0;
i <
v.
size(); ++
i) {
424 for (
int i = 0;
i <
v.
size(); ++
i) {
445 for (
int i = 0;
i <
v.
size(); ++
i) {
447 v(
i) =
static_cast<double>(
val);
466 for (
int i = 0;
i <
v.
size(); ++
i) {
479 for (
int i = 0;
i <
v.
size(); ++
i) {
492 for (
int i = 0;
i <
v.
size(); ++
i) {
507 low_prec(
false), _strings(
new Strings_Holder)
524 it_error(
"it_file::open(): Corrupt file (not an it_file)");
549 "write without a name");
557 const std::string &desc)
565 h1.block_bytes =
h1.hdr_bytes +
h1.data_bytes;
579 std::streampos p =
s.
tellp();
586 s.
seekp(0, std::ios::end);
590 std::streamoff
skip =
static_cast<std::streamoff
>(
h2.block_bytes);
592 if ((
h2.type ==
"") && (
h2.block_bytes >=
h1.block_bytes)) {
593 h1.block_bytes =
h2.block_bytes;
598 else if ((
h2.block_bytes -
h2.hdr_bytes -
h2.data_bytes)
600 h1.block_bytes =
h2.block_bytes -
h2.hdr_bytes -
h2.data_bytes;
601 h2.block_bytes =
h2.hdr_bytes +
h2.data_bytes;
605 s.
seekp(p +
static_cast<std::streamoff
>(
h2.block_bytes));
617 s <<
h.hdr_bytes <<
h.data_bytes <<
h.block_bytes
618 <<
h.name <<
h.type <<
h.desc;
637 h.hdr_bytes = 3 *
sizeof(
uint64_t) + 1 + 1 + 1;
641 s.
seekp(p +
static_cast<std::streamoff
>(
h.block_bytes));
654 s.
seekg(0, std::ios::end);
655 std::streampos p =
s.
tellg();
656 s.
seekg(0, std::ios::beg);
681 size +=
h.hdr_bytes +
h.data_bytes;
683 s.
seekg(p +
static_cast<std::streamoff
>(
h.block_bytes));
688 s.
open(fname(),
true, bfstream_base::l_endian);
707 if (
h.hdr_bytes +
h.data_bytes <
h.block_bytes) {
708 h.block_bytes =
h.hdr_bytes +
h.data_bytes;
712 s.
seekg(p +
static_cast<std::streamoff
>(
h.block_bytes));
794 s <<
static_cast<float>(
v(
i));
806 for (
int i = 0;
i <
v.
size(); ++
i) {
812 for (
int i = 0;
i <
v.
size(); ++
i) {
822 for (std::string::size_type
i = 0;
i <
str.
size(); ++
i)
830 for (
int j = 0;
j < m.cols(); ++
j)
831 for (
int i = 0;
i < m.rows(); ++
i)
832 s << m(
i,
j).value();
839 for (
int j = 0;
j < m.cols(); ++
j)
840 for (
int i = 0;
i < m.rows(); ++
i)
848 for (
int j = 0;
j < m.cols(); ++
j)
849 for (
int i = 0;
i < m.rows(); ++
i)
858 for (
int j = 0;
j < m.cols(); ++
j)
859 for (
int i = 0;
i < m.rows(); ++
i)
860 s <<
static_cast<float>(m(
i,
j));
863 for (
int j = 0;
j < m.cols(); ++
j)
864 for (
int i = 0;
i < m.rows(); ++
i)
874 for (
int j = 0;
j < m.cols(); ++
j)
875 for (
int i = 0;
i < m.rows(); ++
i) {
881 for (
int j = 0;
j < m.cols(); ++
j)
882 for (
int i = 0;
i < m.rows(); ++
i) {
922 s <<
static_cast<float>(
v(
i));
926 s <<
static_cast<double>(
v(
i));
933 for (
int i = 0;
i <
v.
size(); ++
i) {
943 for (
int i = 0;
i <
v.
size(); ++
i) {
949 for (
int i = 0;
i <
v.
size(); ++
i) {
961 it_assert(
h.type ==
"int8",
"it_ifile::operator>>(): Wrong type");
970 it_assert(
h.type ==
"bool",
"it_ifile::operator>>(): Wrong type");
979 it_assert(
h.type ==
"bin",
"it_ifile::operator>>(): Wrong type");
988 it_assert(
h.type ==
"int16",
"it_ifile::operator>>(): Wrong type");
997 if (
h.type ==
"int32")
999 else if (
h.type ==
"int16") {
1002 x =
static_cast<int>(
x16);
1005 it_error(
"it_ifile::operator>>(): Wrong type");
1014 it_assert(
h.type ==
"float32",
"it_ifile::operator>>(): Wrong type");
1023 if (
h.type ==
"float64")
1025 else if (
h.type ==
"float32") {
1028 x =
static_cast<double>(
f32);
1031 it_error(
"it_ifile::operator>>(): Wrong type");
1041 "it_ifile::operator>>(): Wrong type");
1050 if (
h.type ==
"cfloat64")
1052 else if (
h.type ==
"cfloat32") {
1053 std::complex<float>
f32_c;
1055 x =
static_cast<std::complex<double>
>(
f32_c);
1058 it_error(
"it_ifile::operator>>(): Wrong type");
1067 it_assert(
h.type ==
"bvec",
"it_ifile::operator>>(): Wrong type");
1076 it_assert(
h.type ==
"svec",
"it_ifile::operator>>(): Wrong type");
1085 it_assert(
h.type ==
"ivec",
"it_ifile::operator>>(): Wrong type");
1095 if (
h.type ==
"fvec")
1097 else if (
h.type ==
"dvec")
1100 it_error(
"it_ifile::operator>>(): Wrong type");
1110 if (
h.type ==
"fcvec")
1112 else if (
h.type ==
"dcvec")
1115 it_error(
"it_ifile::operator>>(): Wrong type");
1124 it_assert(
h.type ==
"string",
"it_ifile::operator>>(): Wrong type");
1133 it_assert(
h.type ==
"bmat",
"it_ifile::operator>>(): Wrong type");
1142 it_assert(
h.type ==
"smat",
"it_ifile::operator>>(): Wrong type");
1151 it_assert(
h.type ==
"imat",
"it_ifile::operator>>(): Wrong type");
1161 if (
h.type ==
"fmat")
1163 else if (
h.type ==
"dmat")
1166 it_error(
"it_ifile::operator>>(): Wrong type");
1175 if (
h.type ==
"fcmat")
1177 else if (
h.type ==
"dcmat")
1180 it_error(
"it_ifile::operator>>(): Wrong type");
1189 it_assert(
h.type ==
"bArray",
"it_ifile::operator>>(): Wrong type");
1198 it_assert(
h.type ==
"sArray",
"it_ifile::operator>>(): Wrong type");
1207 it_assert(
h.type ==
"iArray",
"it_ifile::operator>>(): Wrong type");
1216 it_assert(
h.type ==
"fArray",
"it_ifile::operator>>(): Wrong type");
1225 if (
h.type ==
"fArray")
1227 else if (
h.type ==
"dArray")
1230 it_error(
"it_ifile::operator>>(): Wrong type");
1239 it_assert(
h.type ==
"fcArray",
"it_ifile::operator>>(): Wrong type");
1248 if (
h.type ==
"fcArray")
1250 else if (
h.type ==
"dcArray")
1253 it_error(
"it_ifile::operator>>(): Wrong type");
1262 it_assert(
h.type ==
"bvecArray",
"it_ifile::operator>>(): Wrong type");
1265 int size =
static_cast<int>(n);
1267 for (
int i = 0;
i <
size; ++
i)
1277 it_assert(
h.type ==
"svecArray",
"it_ifile::operator>>(): Wrong type");
1280 int size =
static_cast<int>(n);
1282 for (
int i = 0;
i <
size; ++
i)
1292 it_assert(
h.type ==
"ivecArray",
"it_ifile::operator>>(): Wrong type");
1295 int size =
static_cast<int>(n);
1297 for (
int i = 0;
i <
size; ++
i)
1307 it_assert(
h.type ==
"vecArray",
"it_ifile::operator>>(): Wrong type");
1310 int size =
static_cast<int>(n);
1312 for (
int i = 0;
i <
size; ++
i)
1322 it_assert(
h.type ==
"cvecArray",
"it_ifile::operator>>(): Wrong type");
1325 int size =
static_cast<int>(n);
1327 for (
int i = 0;
i <
size; ++
i)
1337 it_assert(
h.type ==
"stringArray",
"it_ifile::operator>>(): Wrong type");
1340 int size =
static_cast<int>(n);
1342 for (
int i = 0;
i <
size; ++
i)
1352 it_assert(
h.type ==
"bmatArray",
"it_ifile::operator>>(): Wrong type");
1355 int size =
static_cast<int>(n);
1357 for (
int i = 0;
i <
size; ++
i)
1367 it_assert(
h.type ==
"smatArray",
"it_ifile::operator>>(): Wrong type");
1370 int size =
static_cast<int>(n);
1372 for (
int i = 0;
i <
size; ++
i)
1382 it_assert(
h.type ==
"imatArray",
"it_ifile::operator>>(): Wrong type");
1385 int size =
static_cast<int>(n);
1387 for (
int i = 0;
i <
size; ++
i)
1397 it_assert(
h.type ==
"matArray",
"it_ifile::operator>>(): Wrong type");
1400 int size =
static_cast<int>(n);
1402 for (
int i = 0;
i <
size; ++
i)
1412 it_assert(
h.type ==
"cmatArray",
"it_ifile::operator>>(): Wrong type");
1415 int size =
static_cast<int>(n);
1417 for (
int i = 0;
i <
size; ++
i)
1512 +
v.
size() *
sizeof(
float));
1515 +
v.
size() *
sizeof(
double));
1524 +
v.
size() * 2 *
sizeof(
float));
1527 +
v.
size() * 2 *
sizeof(
double));
1542 + m.rows() * m.cols() *
sizeof(
char));
1550 + m.rows() * m.cols() *
sizeof(
int16_t));
1558 + m.rows() * m.cols() *
sizeof(
int32_t));
1567 + m.rows() * m.cols() *
sizeof(
float));
1570 + m.rows() * m.cols() *
sizeof(
double));
1579 + m.rows() * m.cols() * 2 *
sizeof(
float));
1582 + m.rows() * m.cols() * 2 *
sizeof(
double));
1621 +
v.
size() *
sizeof(
float));
1624 +
v.
size() *
sizeof(
double));
1632 +
v.
size() * 2 *
sizeof(
float));
1641 +
v.
size() * 2 *
sizeof(
float));
1644 +
v.
size() * 2 *
sizeof(
double));
1658 +
sum_l *
sizeof(
char));
1718 +
sum_l *
sizeof(
double));
1738 +
sum_l * 2 *
sizeof(
double));
1758 +
sum_l *
sizeof(
char));
1778 +
sum_l *
sizeof(
char));
1838 +
sum_l *
sizeof(
double));
1858 +
sum_l * 2 *
sizeof(
double));
1896 it_error(
"Corrupt file (Not an it-file)");
1921 if (
h.type !=
"" &&
h.name == name) {
1925 s.
seekg(p +
static_cast<std::streamoff
>(
h.block_bytes));
1938 for (
int i = 0;
i <= n;
i++) {
1947 s.
seekg(
i == n ? p : p +
static_cast<std::streamoff
>(
h.block_bytes));
1970 s.
read(
reinterpret_cast<char *
>(&
h),
sizeof(
h));
1977 std::streampos p =
s.
tellg();
1989 h.block_bytes =
tmp;
1992 s.
seekg(p +
static_cast<std::streamoff
>(
h.hdr_bytes));
2052 v(
i) =
static_cast<double>(
val);
2065 v(
i) =
static_cast<double>(
val);
2127 for (
j = 0;
j <
i;
j++) {
2140 for (
j = 0;
j < m.cols();
j++)
2141 for (
i = 0;
i < m.rows();
i++) {
2143 m(
i,
j) =
static_cast<double>(
val);
2154 for (
j = 0;
j < m.cols();
j++)
2155 for (
i = 0;
i < m.rows();
i++) {
2157 m(
i,
j) =
static_cast<double>(
val);
2167 for (
j = 0;
j < m.cols();
j++)
2168 for (
i = 0;
i < m.rows();
i++) {
2180 for (
j = 0;
j < m.cols();
j++)
2181 for (
i = 0;
i < m.rows();
i++)
2192 for (
j = 0;
j < m.cols();
j++)
2193 for (
i = 0;
i < m.rows();
i++) {
2207 for (
j = 0;
j < m.cols();
j++)
2208 for (
i = 0;
i < m.rows();
i++) {
2238 v(
i) =
static_cast<double>(
val);
2251 v(
i) =
static_cast<double>(
val);
2325_string(
new String_Holder())
2343 it_error(
"Corrupt file (Not an it-file)");
2380 h1.hdr_bytes = 1 + 3 * 4 +
int(type.size()) + 1 +
int(name.size()) + 1;
2382 h1.block_bytes =
h1.hdr_bytes +
h1.data_bytes;
2400 if (
h2.type !=
"" &&
h2.name == name) {
2410 if (
h2.type ==
"" &&
h2.block_bytes >=
h1.block_bytes) {
2411 h1.block_bytes =
h2.block_bytes;
2414 else if (
h2.block_bytes -
h2.hdr_bytes -
h2.data_bytes >=
h1.block_bytes) {
2415 h1.block_bytes =
h2.block_bytes -
h2.hdr_bytes -
h2.data_bytes;
2416 h2.block_bytes =
h2.hdr_bytes +
h2.data_bytes;
2419 availpos =
static_cast<int>(p) +
h2.block_bytes;
2424 s.
seekg(p +
static_cast<std::streamoff
>(
skip));
2429 s.
seekp(0, std::ios::end);
2437 s <<
h.endianity <<
h.hdr_bytes <<
h.data_bytes <<
h.block_bytes <<
h.name <<
h.type;
2455 h.hdr_bytes = 1 + 3 * 4 + 1 + 1;
2459 s.
seekp(p +
static_cast<std::streamoff
>(
h.block_bytes));
2522 s <<
static_cast<float>(
v(
i));
2527 s <<
static_cast<double>(
v(
i));
2549 for (
int i = 0;
i <
v.
size();
i++) {
2556 for (
int i = 0;
i <
v.
size();
i++) {
2568 for (
int i = 0;
i <
size;
i++)
2578 for (
j = 0;
j < m.cols();
j++)
2579 for (
i = 0;
i < m.rows();
i++)
2580 s <<
static_cast<float>(m(
i,
j));
2584 for (
j = 0;
j < m.cols();
j++)
2585 for (
i = 0;
i < m.rows();
i++)
2586 s <<
static_cast<double>(m(
i,
j));
2595 for (
j = 0;
j < m.cols();
j++)
2596 for (
i = 0;
i < m.rows();
i++)
2605 for (
j = 0;
j < m.cols();
j++)
2606 for (
i = 0;
i < m.rows();
i++)
2607 s << m(
i,
j).value();
2616 for (
j = 0;
j < m.cols();
j++)
2617 for (
i = 0;
i < m.rows();
i++) {
2625 for (
j = 0;
j < m.cols();
j++)
2626 for (
i = 0;
i < m.rows();
i++) {
2645 s <<
static_cast<float>(
v(
i));
2650 s <<
static_cast<double>(
v(
i));
2671 for (
int i = 0;
i <
v.
size();
i++) {
2681 for (
int i = 0;
i <
v.
size();
i++) {
2688 for (
int i = 0;
i <
v.
size();
i++) {
2700 if (
h.type ==
"int8")
2713 if (
h.type ==
"bin")
2726 if (
h.type ==
"int16")
2739 if (
h.type ==
"int32")
2741 else if (
h.type ==
"int16") {
2757 if (
h.type ==
"float64")
2759 else if (
h.type ==
"float32") {
2775 if (
h.type ==
"float32")
2789 if (
h.type ==
"float32_complex") {
2790 std::complex<float>
f32_c;
2805 if (
h.type ==
"float64_complex")
2807 else if (
h.type ==
"float32_complex") {
2808 std::complex<float>
f32_c;
2823 if (
h.type ==
"fvec")
2825 else if (
h.type ==
"dvec")
2838 if (
h.type ==
"ivec")
2851 if (
h.type ==
"bvec")
2864 if (
h.type ==
"fcvec")
2866 else if (
h.type ==
"dcvec")
2879 if (
h.type ==
"string")
2892 if (
h.type ==
"fmat")
2894 else if (
h.type ==
"dmat")
2907 if (
h.type ==
"imat")
2920 if (
h.type ==
"bmat")
2933 if (
h.type ==
"fcmat")
2935 else if (
h.type ==
"dcmat")
2948 if (
h.type ==
"fArray")
2961 if (
h.type ==
"fArray")
2963 else if (
h.type ==
"dArray")
2976 if (
h.type ==
"iArray")
2989 if (
h.type ==
"bArray")
3002 if (
h.type ==
"fcArray")
3015 if (
h.type ==
"fcArray")
3017 else if (
h.type ==
"dcArray")
3030 if (
h.type ==
"vecArray") {
3034 for (
int i = 0;
i < n;
i++)
3048 if (
h.type ==
"ivecArray") {
3052 for (
int i = 0;
i < n;
i++)
3066 if (
h.type ==
"bvecArray") {
3070 for (
int i = 0;
i < n;
i++)
3084 if (
h.type ==
"cvecArray") {
3088 for (
int i = 0;
i < n;
i++)
3102 if (
h.type ==
"stringArray") {
3106 for (
int i = 0;
i < n;
i++)
3120 if (
h.type ==
"matArray") {
3124 for (
int i = 0;
i < n;
i++)
3138 if (
h.type ==
"imatArray") {
3142 for (
int i = 0;
i < n;
i++)
3156 if (
h.type ==
"bmatArray") {
3160 for (
int i = 0;
i < n;
i++)
3174 if (
h.type ==
"cmatArray") {
3178 for (
int i = 0;
i < n;
i++)
3327 f.
write_data_header(
"fcmat", 2*
sizeof(
int) + 2*m.rows()*m.cols()*
sizeof(
float));
3329 f.
write_data_header(
"dcmat", 2*
sizeof(
int) + 2*m.rows()*m.cols()*
sizeof(
double));
int size() const
Returns the number of data elements in the array object.
void set_size(int n, bool copy=false)
Resizing an Array<T>.
endian get_native_endianity() const
Returns the native endianity for this computer architecture.
void set_endianity(endian e)
Set the endianity for this class.
endian
Definition of the endian data type.
void open_readonly(const std::string &name, endian e=b_endian)
Open a file for reading only and set the endianity.
void open(const std::string &name, bool trunc=false, endian e=b_endian)
Open a file for reading and writing and set the endianity.
Binary arithmetic (boolean) class.
char value() const
Output the binary value of the object.
bool eof() const
This method returns true if eof is reached.
Fstream_Binfile_Facade & seekg(std::streampos pos)
Set position.
Fstream_Binfile_Facade & put(const char c)
Output single char.
int get()
Get single char.
Fstream_Binfile_Facade & read(char *s, std::streamsize n)
Read n chars from stream.
void close()
Method to close corresponding file.
bool is_open()
Open state.
void clear(std::ios_base::iostate state=std::ios_base::goodbit)
Method to set stream state (overwrites stream state flags)
std::streampos tellp()
Get position.
Fstream_Binfile_Facade & flush()
Flushes stream buffer.
Fstream_Binfile_Facade & seekp(std::streampos pos)
Set position.
std::streampos tellg()
Get position.
Fstream_Binfile_Facade & write(const char *c, std::streamsize n)
Output multiple characters.
static char file_version
ACTION: Add documentation.
static char file_magic[4]
ACTION: Add documentation.
static char file_magic[4]
IT++ file marker: "IT++".
static char file_version
IT++ file version.
The old (version 2) IT++ file format reading and writing class.
void write_data_header(const std::string &type, uint32_t size)
Write the data header for a variable, specifying the type and size of the data to follow.
bool low_prec
ACTION: Add documenation for this protected member.
void flush()
Flush the data to disk.
void close()
Close the file.
bool get_low_precision()
Get the precision.
bool exists(const std::string &name)
Returns true if the variable name exists in the file.
it_file_old()
Constructor.
std::string & next_name()
ACTION: Add documenation for this protected member.
void write_file_header()
Write the header for the it_file_old.
void low_level_write(char x)
Write a char value at the current file pointer position.
void remove()
ACTION: Add documenation for this protected member.
void open(const std::string &name, bool trunc=false)
Open a file for reading and writing.
void write_data_header_here(const data_header &h)
ACTION: Add documenation for this protected member.
void pack()
Remove slack space from the file.
The IT++ file format reading and writing class.
void write_data_header(const std::string &type, uint64_t size)
Write the data header for a variable, specifying the type and size of the data to follow.
void flush()
Flush the data to disk.
bool get_low_precision() const
Get the precision.
std::string & next_name()
Name to be used for saving the next variable.
void open(const std::string &filename, bool trunc=false)
Open a file for reading and writing.
void write_data_header_here(const data_header &h)
Write data header h at the current file position.
void close()
Close the file.
std::string & next_desc()
Description to be used for saving the next variable.
void write_file_header()
Write the header for the it_file.
void remove()
Remove the current variable, denoted by next_name.
bool exists(const std::string &name)
Returns true if the variable name exists in the file.
it_file()
Default constructor.
void pack()
Remove slack space from the file.
void low_level_write(char x)
Write a char value at the current file pointer position.
The old (version 2) IT++ file format reading class.
void open(const std::string &name)
Open a file. The file must exist.
void low_level_read_lo(vec &v)
Read a vector of float values at the current file pointer position.
bool seek(const std::string &name)
Find the variable name.
void low_level_read_hi(vec &v)
Read a vector of double values at the current file pointer position.
it_ifile_old()
Constructor.
void info(std::string &name, std::string &type, int &bytes)
Get information about the current variable.
void low_level_read(char &x)
Read a char value at the current file pointer position.
void read_data_header(data_header &h)
Read the data header and return the result in the variable h.
virtual void close()
Close a file.
bool read_check_file_header()
Reads and checks the file data header. Returns true if the header is valid and false otherwise.
bfstream s
Protected binary file stream.
The IT++ file format reading class.
bool seek(const std::string &name)
Find the variable name.
void open(const std::string &filename)
Open an existing file in read-only mode.
virtual void close()
Close the file.
void low_level_read(char &x)
Read a char value at the current file pointer position.
void low_level_read_lo(vec &v)
Read a vector of float values at the current file pointer position.
bool read_check_file_header()
Read and check the file header. Return true if the header is valid and false otherwise.
void read_data_header(it_file_base::data_header &h)
Read data header and return the result in the variable h.
bfstream s
Protected binary file stream.
void info(std::string &name, std::string &type, std::string &desc, uint64_t &bytes)
Get information about the current variable.
void low_level_read_hi(vec &v)
Read a vector of double values at the current file pointer position.
it_ifile()
Default constructor.
#define it_error_if(t, s)
Abort if t is true.
#define it_error(s)
Abort unconditionally.
#define it_warning(s)
Display a warning message.
#define it_assert(t, s)
Abort if t is not true.
bool exist(const std::string &name)
Checks if a file named name already exists on the disk.
int size(const Vec< T > &v)
Length of vector.
vec imag(const cvec &data)
Imaginary part of complex values.
vec real(const cvec &data)
Real part of complex values.
Definition of classes for the IT++ file format.
Mat< bin > bmat
bin matrix
std::ostream & operator<<(std::ostream &output, const bin &inbin)
Output stream of bin.
std::istream & operator>>(std::istream &input, bin &outbin)
Input stream of bin.