itpp::it_ifile Class Reference
Base Module » IT++ File Format

The IT++ file format reading class. More...

`#include <itpp/base/itfile.h>`

Inheritance diagram for itpp::it_ifile:

## Public Member Functions

| it_ifile ()
| Default constructor.
| it_ifile (const std::string &filename)
| Constructor that calls open(filename)
virtual | ~it_ifile ()
| Destructor.
void | open (const std::string &filename)
| Open an existing file in read-only mode.
virtual void | close ()
| Close the file.
bfstream & | low_level ()
| Returns pointer to the underlying `bfstream` used.
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`.
void | low_level_read (char &x)
| Read a char value at the current file pointer position.
void | low_level_read (uint64_t &x)
| Read a 64-bit unsigned integer value at the current file pointer position.
void | low_level_read (bool &x)
| Read a bool value at the current file pointer position.
void | low_level_read (bin &x)
| Read a binary value at the current file pointer position.
void | low_level_read (short &x)
| Read a short value at the current file pointer position.
void | low_level_read (int &x)
| Read an integer value at the current file pointer position.
void | low_level_read (float &x)
| Read a float value at the current file pointer position.
void | low_level_read (double &x)
| Read a double value at the current file pointer position.
void | low_level_read (std::complex< float > &x)
| Read a float complex value at the current file pointer position.
void | low_level_read (std::complex< double > &x)
| Read a double complex value at the current file pointer position.
void | low_level_read (bvec &v)
| Read a vector of binary values at the current file pointer position.
void | low_level_read (svec &v)
| Read a vector of short integer values at the current file pointer position.
void | low_level_read (ivec &v)
| Read a vector of integer values 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.
void | low_level_read_hi (vec &v)
| Read a vector of double values at the current file pointer position.
void | low_level_read_lo (cvec &v)
| Read a vector of float complex values at the current file pointer position.
void | low_level_read_hi (cvec &v)
| Read a vector of double complex values at the current file pointer position.
void | low_level_read (std::string &str)
| Read a string at the current file pointer position.
void | low_level_read (bmat &m)
| Read a matrix of binary values at the current file pointer position.
void | low_level_read (smat &m)
| Read a matrix of short integer values at the current file pointer position.
void | low_level_read (imat &m)
| Read a matrix of integer values at the current file pointer position.
void | low_level_read_lo (mat &m)
| Read a matrix of float values at the current file pointer position.
void | low_level_read_hi (mat &m)
| Read a matrix of double values at the current file pointer position.
void | low_level_read_lo (cmat &m)
| Read a matrix of float complex values at the current file pointer position.
void | low_level_read_hi (cmat &m)
| Read a matrix of double complex values at the current file pointer position.
void | low_level_read (Array< bin > &v)
| Read an Array of binary values at the current file pointer position.
void | low_level_read (Array< short > &v)
| Read an Array of short integer values at the current file pointer position.
void | low_level_read (Array< int > &v)
| Read an Array of integer values at the current file pointer position.
void | low_level_read (Array< float > &v)
| Read an Array of float values at the current file pointer position.
void | low_level_read_lo (Array< double > &v)
| Read an Array of float values at the current file pointer position.
void | low_level_read_hi (Array< double > &v)
| Read an Array of double values at the current file pointer position.
void | low_level_read (Array< std::complex< float > > &v)
| Read an Array of float complex values at the current file pointer position.
void | low_level_read_lo (Array< std::complex< double > > &v)
| Read an Array of float complex values at the current file pointer position.
void | low_level_read_hi (Array< std::complex< double > > &v)
| Read an Array of double complex values at the current file pointer position.
bool | seek (const std::string &name)
| Find the variable `name`.
bool | seek (int n)
| Find the variable number `n`.
void | info (std::string &name, std::string &type, std::string &desc, uint64_t &bytes)
| Get information about the current variable.

## Protected Attributes

bfstream | s
| Protected binary file stream.

## Static Protected Attributes

static char | file_magic [4] = { 'I', 'T', '+', '+' }
| IT++ file marker: "IT++".
static char | file_version = 3
| IT++ file version.

## Detailed Description

The IT++ file format reading class.

Definition at line 132 of file itfile.h.

## Constructor & Destructor Documentation

## it_ifile() [1/2]

itpp::it_ifile::it_ifile | ( |  | ) |

Default constructor.

Definition at line 43 of file itfile.cpp.

## it_ifile() [2/2]

itpp::it_ifile::it_ifile | ( | const std::string & | filename | ) |

explicit

Constructor that calls open(filename)

Definition at line 45 of file itfile.cpp.

References open().

## ~it_ifile()

virtual itpp::it_ifile::~it_ifile | ( |  | ) |

inlinevirtual

Destructor.

Definition at line 140 of file itfile.h.

## Member Function Documentation

## open()

void itpp::it_ifile::open | ( | const std::string & | filename | ) |

Open an existing file in read-only mode.

Definition at line 50 of file itfile.cpp.

References itpp::binfile_details::Fstream_Binfile_Facade::close(), itpp::exist(), it_assert, it_error, itpp::bfstream::open_readonly(), read_check_file_header(), and s.

Referenced by it_ifile().

## close()

void itpp::it_ifile::close | ( |  | ) |

virtual

Close the file.

Reimplemented in itpp::it_file.

Definition at line 60 of file itfile.cpp.

References itpp::binfile_details::Fstream_Binfile_Facade::close(), and s.

Referenced by itpp::it_load_var_as(), itpp::LDPC_Generator_Systematic::load(), itpp::BLDPC_Generator::load(), and itpp::LDPC_Code::load_code().

## low_level()

bfstream & itpp::it_ifile::low_level | ( |  | ) |

inline

Returns pointer to the underlying `bfstream` used.

Definition at line 146 of file itfile.h.

## read_check_file_header()

bool itpp::it_ifile::read_check_file_header | ( |  | ) |

Read and check the file header. Return true if the header is valid and false otherwise.

Definition at line 126 of file itfile.cpp.

References itpp::it_file_base::file_magic, itpp::it_file_base::file_version, itpp::binfile_details::Fstream_Binfile_Facade::read(), and s.

Referenced by open(), and itpp::it_file::open().

## read_data_header()

void itpp::it_ifile::read_data_header | ( | it_file_base::data_header & | h | ) |

Read data header and return the result in the variable `h`.

Definition at line 134 of file itfile.cpp.

References itpp::binfile_details::Fstream_Binfile_Facade::clear(), and s.

Referenced by info(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::it_file::pack(), itpp::it_file::remove(), seek(), seek(), and itpp::it_file::write_data_header().

## low_level_read() [1/22]

void itpp::it_ifile::low_level_read | ( | char & | x | ) |

Read a char value at the current file pointer position.

Definition at line 145 of file itfile.cpp.

References s.

Referenced by itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), and itpp::operator>>().

## low_level_read() [2/22]

void itpp::it_ifile::low_level_read | ( | uint64_t & | x | ) |

Read a 64-bit unsigned integer value at the current file pointer position.

Definition at line 150 of file itfile.cpp.

References s.

## low_level_read() [3/22]

void itpp::it_ifile::low_level_read | ( | bool & | x | ) |

Read a bool value at the current file pointer position.

Definition at line 155 of file itfile.cpp.

References s.

## low_level_read() [4/22]

void itpp::it_ifile::low_level_read | ( | bin & | x | ) |

Read a binary value at the current file pointer position.

Definition at line 163 of file itfile.cpp.

References s.

## low_level_read() [5/22]

void itpp::it_ifile::low_level_read | ( | short & | x | ) |

Read a short value at the current file pointer position.

Definition at line 170 of file itfile.cpp.

References s.

## low_level_read() [6/22]

void itpp::it_ifile::low_level_read | ( | int & | x | ) |

Read an integer value at the current file pointer position.

Definition at line 177 of file itfile.cpp.

References s.

## low_level_read() [7/22]

void itpp::it_ifile::low_level_read | ( | float & | x | ) |

Read a float value at the current file pointer position.

Definition at line 184 of file itfile.cpp.

References s.

## low_level_read() [8/22]

void itpp::it_ifile::low_level_read | ( | double & | x | ) |

Read a double value at the current file pointer position.

Definition at line 189 of file itfile.cpp.

References s.

## low_level_read() [9/22]

void itpp::it_ifile::low_level_read | ( | std::complex< float > & | x | ) |

Read a float complex value at the current file pointer position.

Definition at line 194 of file itfile.cpp.

References s.

## low_level_read() [10/22]

void itpp::it_ifile::low_level_read | ( | std::complex< double > & | x | ) |

Read a double complex value at the current file pointer position.

Definition at line 202 of file itfile.cpp.

References s.

## low_level_read() [11/22]

void itpp::it_ifile::low_level_read | ( | bvec & | v | ) |

Read a vector of binary values at the current file pointer position.

Definition at line 210 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

## low_level_read() [12/22]

void itpp::it_ifile::low_level_read | ( | svec & | v | ) |

Read a vector of short integer values at the current file pointer position.

Definition at line 222 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

## low_level_read() [13/22]

void itpp::it_ifile::low_level_read | ( | ivec & | v | ) |

Read a vector of integer values at the current file pointer position.

Definition at line 234 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

## low_level_read_lo() [1/6]

void itpp::it_ifile::low_level_read_lo | ( | vec & | v | ) |

Read a vector of float values at the current file pointer position.

Definition at line 246 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

Referenced by itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), and itpp::operator>>().

## low_level_read_hi() [1/6]

void itpp::it_ifile::low_level_read_hi | ( | vec & | v | ) |

Read a vector of double values at the current file pointer position.

Definition at line 258 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

Referenced by itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), itpp::operator>>(), and itpp::operator>>().

## low_level_read_lo() [2/6]

void itpp::it_ifile::low_level_read_lo | ( | cvec & | v | ) |

Read a vector of float complex values at the current file pointer position.

Definition at line 267 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

## low_level_read_hi() [2/6]

void itpp::it_ifile::low_level_read_hi | ( | cvec & | v | ) |

Read a vector of double complex values at the current file pointer position.

Definition at line 280 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

## low_level_read() [14/22]

void itpp::it_ifile::low_level_read | ( | std::string & | str | ) |

Read a string at the current file pointer position.

Definition at line 293 of file itfile.cpp.

References s, and itpp::size().

## low_level_read() [15/22]

void itpp::it_ifile::low_level_read | ( | bmat & | m | ) |

Read a matrix of binary values at the current file pointer position.

Definition at line 303 of file itfile.cpp.

References s, and itpp::Array< T >::set_size().

## low_level_read() [16/22]

void itpp::it_ifile::low_level_read | ( | smat & | m | ) |

Read a matrix of short integer values at the current file pointer position.

Definition at line 317 of file itfile.cpp.

References s, and itpp::Array< T >::set_size().

## low_level_read() [17/22]

void itpp::it_ifile::low_level_read | ( | imat & | m | ) |

Read a matrix of integer values at the current file pointer position.

Definition at line 330 of file itfile.cpp.

References s, and itpp::Array< T >::set_size().

## low_level_read_lo() [3/6]

void itpp::it_ifile::low_level_read_lo | ( | mat & | m | ) |

Read a matrix of float values at the current file pointer position.

Definition at line 343 of file itfile.cpp.

References s, and itpp::Array< T >::set_size().

## low_level_read_hi() [3/6]

void itpp::it_ifile::low_level_read_hi | ( | mat & | m | ) |

Read a matrix of double values at the current file pointer position.

Definition at line 356 of file itfile.cpp.

References s, and itpp::Array< T >::set_size().

## low_level_read_lo() [4/6]

void itpp::it_ifile::low_level_read_lo | ( | cmat & | m | ) |

Read a matrix of float complex values at the current file pointer position.

Definition at line 366 of file itfile.cpp.

References s, and itpp::Array< T >::set_size().

## low_level_read_hi() [4/6]

void itpp::it_ifile::low_level_read_hi | ( | cmat & | m | ) |

Read a matrix of double complex values at the current file pointer position.

Definition at line 380 of file itfile.cpp.

References s, and itpp::Array< T >::set_size().

## low_level_read() [18/22]

void itpp::it_ifile::low_level_read | ( | Array< bin > & | v | ) |

Read an Array of binary values at the current file pointer position.

Definition at line 394 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

## low_level_read() [19/22]

void itpp::it_ifile::low_level_read | ( | Array< short > & | v | ) |

Read an Array of short integer values at the current file pointer position.

Definition at line 406 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

## low_level_read() [20/22]

void itpp::it_ifile::low_level_read | ( | Array< int > & | v | ) |

Read an Array of integer values at the current file pointer position.

Definition at line 418 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

## low_level_read() [21/22]

void itpp::it_ifile::low_level_read | ( | Array< float > & | v | ) |

Read an Array of float values at the current file pointer position.

Definition at line 430 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

## low_level_read_lo() [5/6]

void itpp::it_ifile::low_level_read_lo | ( | Array< double > & | v | ) |

Read an Array of float values at the current file pointer position.

Definition at line 439 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

## low_level_read_hi() [5/6]

void itpp::it_ifile::low_level_read_hi | ( | Array< double > & | v | ) |

Read an Array of double values at the current file pointer position.

Definition at line 451 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

## low_level_read() [22/22]

void itpp::it_ifile::low_level_read | ( | Array< std::complex< float > > & | v | ) |

Read an Array of float complex values at the current file pointer position.

Definition at line 460 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

## low_level_read_lo() [6/6]

void itpp::it_ifile::low_level_read_lo | ( | Array< std::complex< double > > & | v | ) |

Read an Array of float complex values at the current file pointer position.

Definition at line 473 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

## low_level_read_hi() [6/6]

void itpp::it_ifile::low_level_read_hi | ( | Array< std::complex< double > > & | v | ) |

Read an Array of double complex values at the current file pointer position.

Definition at line 486 of file itfile.cpp.

References s, itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

## seek() [1/2]

bool itpp::it_ifile::seek | ( | const std::string & | name | ) |

Find the variable `name`.

Definition at line 65 of file itfile.cpp.

References itpp::binfile_details::Fstream_Binfile_Facade::clear(), itpp::binfile_details::Fstream_Binfile_Facade::eof(), read_data_header(), s, itpp::binfile_details::Fstream_Binfile_Facade::seekg(), and itpp::binfile_details::Fstream_Binfile_Facade::tellg().

Referenced by itpp::it_file::exists(), itpp::it_load_var_as(), itpp::operator>>(), and itpp::it_file::remove().

## seek() [2/2]

bool itpp::it_ifile::seek | ( | int | n | ) |

Find the variable number `n`.

Definition at line 90 of file itfile.cpp.

References itpp::binfile_details::Fstream_Binfile_Facade::clear(), itpp::binfile_details::Fstream_Binfile_Facade::eof(), read_data_header(), s, itpp::binfile_details::Fstream_Binfile_Facade::seekg(), and itpp::binfile_details::Fstream_Binfile_Facade::tellg().

## info()

void itpp::it_ifile::info | ( | std::string & | name,
|  | std::string & | type,
|  | std::string & | desc,
|  | uint64_t & | bytes
| ) |  |

Get information about the current variable.

Definition at line 111 of file itfile.cpp.

References read_data_header(), s, itpp::binfile_details::Fstream_Binfile_Facade::seekg(), and itpp::binfile_details::Fstream_Binfile_Facade::tellg().

## Member Data Documentation

## s

bfstream itpp::it_ifile::s

protected

Protected binary file stream.

Definition at line 237 of file itfile.h.

Referenced by close(), itpp::it_file::close(), itpp::it_file::flush(), info(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read(), low_level_read_hi(), low_level_read_hi(), low_level_read_hi(), low_level_read_hi(), low_level_read_hi(), low_level_read_hi(), low_level_read_lo(), low_level_read_lo(), low_level_read_lo(), low_level_read_lo(), low_level_read_lo(), low_level_read_lo(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), itpp::it_file::low_level_write(), open(), itpp::it_file::open(), itpp::it_file::pack(), read_check_file_header(), read_data_header(), itpp::it_file::remove(), seek(), seek(), itpp::it_file::write_data_header(), itpp::it_file::write_data_header_here(), and itpp::it_file::write_file_header().

## file_magic

char itpp::it_file_base::file_magic = { 'I', 'T', '+', '+' }

staticprotectedinherited

IT++ file marker: "IT++".

Definition at line 122 of file itfile.h.

Referenced by read_check_file_header(), and itpp::it_file::write_file_header().

## file_version

char itpp::it_file_base::file_version = 3

staticprotectedinherited

IT++ file version.

Definition at line 124 of file itfile.h.

Referenced by read_check_file_header(), and itpp::it_file::write_file_header().

The documentation for this class was generated from the following files:

- itpp/base/itfile.h
- itpp/base/itfile.cpp

Generated on Mon Jun 10 2024 11:49:36 for IT++ by Doxygen 1.9.8