contains routines for reading/writing in ASCII/BINARY format More...
Functions | |
template<class data_T> | |
void | absorbASCII (std::fstream &str, bitpit::PiercedVector< data_T > &data) |
template<class data_T> | |
void | absorbASCII (std::fstream &str, bitpit::PiercedVector< data_T > &data, long) |
template<class data_T> | |
void | absorbASCII (std::fstream &str, data_T &data) |
template<class data_T> | |
void | absorbASCII (std::fstream &str, data_T *data, int nr) |
template<class data_T, size_t d> | |
void | absorbASCII (std::fstream &str, std::array< data_T, d > &data) |
template<class data_T> | |
void | absorbASCII (std::fstream &str, std::vector< data_T > &data) |
template<class data_T, size_t d> | |
void | absorbASCII (std::fstream &str, std::vector< std::array< data_T, d > > &data) |
template<class data_T> | |
void | absorbASCII (std::fstream &str, std::vector< std::vector< data_T > > &data) |
template<class data_T> | |
void | absorbBINARY (std::fstream &str, bitpit::PiercedVector< data_T > &data) |
template<class data_T> | |
void | absorbBINARY (std::fstream &str, bitpit::PiercedVector< data_T > &data, long) |
template<class data_T> | |
void | absorbBINARY (std::fstream &str, data_T &data) |
template<class data_T> | |
void | absorbBINARY (std::fstream &str, data_T *data, int nr) |
template<class data_T, size_t d> | |
void | absorbBINARY (std::fstream &str, std::array< data_T, d > &data) |
template<class data_T> | |
void | absorbBINARY (std::fstream &str, std::vector< data_T > &data) |
template<class data_T, size_t d> | |
void | absorbBINARY (std::fstream &str, std::vector< std::array< data_T, d > > &data) |
template<class data_T> | |
void | absorbBINARY (std::fstream &str, std::vector< std::vector< data_T > > &data) |
void | copyUntilEOFInString (std::fstream &str, char *&buffer, int &length) |
template<class data_T> | |
void | flushASCII (std::fstream &str, const data_T &data) |
template<class data_T, size_t d> | |
void | flushASCII (std::fstream &str, const std::array< data_T, d > &data) |
template<class data_T> | |
void | flushASCII (std::fstream &str, const std::vector< data_T > &data) |
template<> | |
void | flushASCII (std::fstream &str, const uint8_t &data) |
template<> | |
void | flushASCII (std::fstream &str, const uint8_t &data) |
template<class data_T> | |
void | flushASCII (std::fstream &str, int elements_per_line, const bitpit::PiercedVector< data_T > &data, bool writeIndex=false) |
template<class data_T> | |
void | flushASCII (std::fstream &str, int elements_per_line, const data_T *data, int nr) |
template<class data_T, size_t d> | |
void | flushASCII (std::fstream &str, int elements_per_line, const std::array< data_T, d > &data) |
template<class data_T> | |
void | flushASCII (std::fstream &str, int elements_per_line, const std::vector< data_T > &data) |
template<class data_T> | |
void | flushBINARY (std::fstream &str, const bitpit::PiercedVector< data_T > &, bool writeIndex=false) |
template<class data_T> | |
void | flushBINARY (std::fstream &str, const data_T &data) |
template<class data_T> | |
void | flushBINARY (std::fstream &str, const data_T *data, int nr) |
template<class data_T, size_t d> | |
void | flushBINARY (std::fstream &str, const std::array< data_T, d > &data) |
template<class data_T> | |
void | flushBINARY (std::fstream &str, const std::vector< data_T > &data) |
template<class data_T, size_t d> | |
void | flushBINARY (std::fstream &str, const std::vector< std::array< data_T, d > > &data) |
template<class data_T> | |
void | flushBINARY (std::fstream &str, const std::vector< std::vector< data_T > > &data) |
template<class data_T> | |
void | lineStream (std::fstream &str, data_T &data) |
template<class data_T, size_t d> | |
void | lineStream (std::fstream &str, data_T *data, int nr) |
template<class data_T> | |
void | lineStream (std::fstream &str, data_T *data, int nr) |
template<class data_T, size_t d> | |
void | lineStream (std::fstream &str, std::array< data_T, d > &data) |
template<class data_T> | |
void | lineStream (std::fstream &str, std::vector< data_T > &data) |
Detailed Description
contains routines for reading/writing in ASCII/BINARY format
Function Documentation
◆ absorbASCII() [1/8]
void bitpit::genericIO::absorbASCII | ( | std::fstream & | str, |
bitpit::PiercedVector< data_T > & | data ) |
Reads only the values of the elemnts of a bitpit::PiercedVector from file stream in ascii format.
- Template Parameters
-
data_T type of POD data
- Parameters
-
[in] str file stream [in] data data to be read
Definition at line 764 of file GenericIO.tpp.
◆ absorbASCII() [2/8]
void bitpit::genericIO::absorbASCII | ( | std::fstream & | str, |
bitpit::PiercedVector< data_T > & | data, | ||
long | N ) |
Reads a bitpit::PiercedVector from file stream in ascii format, both indices and values of its elements. Relies on the function lineStream.
- Template Parameters
-
data_T type of POD data
- Parameters
-
[in] str file stream [in] data data to be read [in] N number of elements to br read
Definition at line 795 of file GenericIO.tpp.
◆ absorbASCII() [3/8]
void bitpit::genericIO::absorbASCII | ( | std::fstream & | str, |
data_T & | data ) |
Reads a templated data type from file stream in ascii Relies on the ">>" operator.
- Template Parameters
-
data_T type of POD data
- Parameters
-
[in] str file stream [in] data data to be read
Definition at line 542 of file GenericIO.tpp.
◆ absorbASCII() [4/8]
void bitpit::genericIO::absorbASCII | ( | std::fstream & | str, |
data_T * | data, | ||
int | nr ) |
Reads a C array of data type from file stream in ascii. If not enough elements are present in the file an error message is displayed on log::cout() Relies on the function lineStream.
- Template Parameters
-
data_T class stored in C array d size of std::array
- Parameters
-
[in] str file stream [in] data pointer to C array [in] nr number of elements
Definition at line 725 of file GenericIO.tpp.
◆ absorbASCII() [5/8]
void bitpit::genericIO::absorbASCII | ( | std::fstream & | str, |
std::array< data_T, d > & | data ) |
Reads a std::array of data type from file stream in ascii. The size of the array defines the number of elements to be read. If not enough elements are present in the file an error message is displayed on log::cout() Relies on the function lineStream.
- Template Parameters
-
data_T class stored in std::array d size of std::array
- Parameters
-
[in] str file stream [in] data data to be read
Definition at line 682 of file GenericIO.tpp.
◆ absorbASCII() [6/8]
void bitpit::genericIO::absorbASCII | ( | std::fstream & | str, |
std::vector< data_T > & | data ) |
Reads a std::vector of data type from file stream in ascii. The size of the vector defines the number of elements to be read. If not enough elements are present in the file an error message is displayed on log::cout() Relies on the function lineStream.
- Template Parameters
-
data_T type of POD data
- Parameters
-
[in] str file stream [in] data data to be read
Definition at line 557 of file GenericIO.tpp.
◆ absorbASCII() [7/8]
void bitpit::genericIO::absorbASCII | ( | std::fstream & | str, |
std::vector< std::array< data_T, d > > & | data ) |
Reads a std::vector of std::array of templated POD data type of templated size from file stream in asci format
- Template Parameters
-
data_T type of data d size of array
- Parameters
-
[in] str file stream [in] data data to be read
Definition at line 657 of file GenericIO.tpp.
◆ absorbASCII() [8/8]
void bitpit::genericIO::absorbASCII | ( | std::fstream & | str, |
std::vector< std::vector< data_T > > & | data ) |
Reads a std::vector of std::vector of templated POD data type from file stream in ascii format
- Template Parameters
-
data_T type of data
- Parameters
-
[in] str file stream [in] data data to be read
Definition at line 596 of file GenericIO.tpp.
◆ absorbBINARY() [1/8]
void bitpit::genericIO::absorbBINARY | ( | std::fstream & | str, |
PiercedVector< data_T > & | data ) |
Reads a bitpit::PiercedVector file stream in binary format. The PiercedVector should already contain the indices of its elements and the data of all elements will be read. It assumes that absorbBINARY is available for data_T; this implies that data_T is of known size.
- Template Parameters
-
data_T type data
- Parameters
-
[in] str file stream [in] data data to be written
Definition at line 921 of file GenericIO.tpp.
◆ absorbBINARY() [2/8]
void bitpit::genericIO::absorbBINARY | ( | std::fstream & | str, |
PiercedVector< data_T > & | data, | ||
long | nElements ) |
Reads a bitpit::PiercedVector file stream in binary format, both the indices and data of its elements. The user must specify how many elements should be read from the stream. It assumes that absorbBINARY is available for data_T; this implies that data_T is of sized size
- Template Parameters
-
data_T type data
- Parameters
-
[in] str file stream [in] data data to be written [in] nElements the number of elements that should be read
Definition at line 940 of file GenericIO.tpp.
◆ absorbBINARY() [3/8]
void bitpit::genericIO::absorbBINARY | ( | std::fstream & | str, |
data_T & | data ) |
Reads a templated data type from file stream in binary
- Template Parameters
-
data_T type of data
- Parameters
-
[in] str file stream [in] data data to be read
Definition at line 825 of file GenericIO.tpp.
◆ absorbBINARY() [4/8]
void bitpit::genericIO::absorbBINARY | ( | std::fstream & | str, |
data_T * | data, | ||
int | nr ) |
Reads a C array of templated data type from file stream in binary format
- Template Parameters
-
data_T type of data
- Parameters
-
[in] str file stream [in] data data to be read [in] nr number of elements to be read
Definition at line 904 of file GenericIO.tpp.
◆ absorbBINARY() [5/8]
void bitpit::genericIO::absorbBINARY | ( | std::fstream & | str, |
std::array< data_T, d > & | data ) |
Reads a std::array of templated POD data type of templated size from file stream in binary format
- Template Parameters
-
data_T type of data d size of array
- Parameters
-
[in] str file stream [in] data data to be read
Definition at line 888 of file GenericIO.tpp.
◆ absorbBINARY() [6/8]
void bitpit::genericIO::absorbBINARY | ( | std::fstream & | str, |
std::vector< data_T > & | data ) |
Reads a std::vector of templated POD data type from file stream in binary format
- Template Parameters
-
data_T type of data
- Parameters
-
[in] str file stream [in] data data to be read
Definition at line 840 of file GenericIO.tpp.
◆ absorbBINARY() [7/8]
void bitpit::genericIO::absorbBINARY | ( | std::fstream & | str, |
std::vector< std::array< data_T, d > > & | data ) |
Reads a std::vector of std::array of templated POD data type of templated size from file stream in binary
- Template Parameters
-
data_T type of data d size of array
- Parameters
-
[in] str file stream [in] data data to be read
Definition at line 871 of file GenericIO.tpp.
◆ absorbBINARY() [8/8]
void bitpit::genericIO::absorbBINARY | ( | std::fstream & | str, |
std::vector< std::vector< data_T > > & | data ) |
Reads a std::vector of std::vector of templated POD data type from file stream in binary format
- Template Parameters
-
data_T type of data
- Parameters
-
[in] str file stream [in] data data to be read
Definition at line 856 of file GenericIO.tpp.
◆ copyUntilEOFInString()
void bitpit::genericIO::copyUntilEOFInString | ( | std::fstream & | str, |
char *& | buffer, | ||
int & | length ) |
Copies entire file into a char array.
NOTE: only valid characters will be copied.
NOTE: On Windows OS, read-from-file \r
characters take 2 position in the stream, but are accounted as a unique character (endline) after C++ translation with read function.
- Parameters
-
[in] str file stream to be copied; file needs already to be opened [out] buffer char array containing entire array (only valid characters) [out] length number of elements which have been copied
Definition at line 61 of file GenericIO.cpp.
◆ flushASCII() [1/9]
void bitpit::genericIO::flushASCII | ( | std::fstream & | str, |
const data_T & | data ) |
Writes a POD data type to file stream in ascii format using scientific format
- Template Parameters
-
data_T type of POD data
- Parameters
-
[in] str file stream [in] data data to be written
Definition at line 38 of file GenericIO.tpp.
◆ flushASCII() [2/9]
void bitpit::genericIO::flushASCII | ( | std::fstream & | str, |
const std::array< data_T, d > & | data ) |
Writes a array of POD data type to file stream in ascii format using scientific format on one single line
- Template Parameters
-
data_T type of POD data d size of array
- Parameters
-
[in] str file stream [in] data data to be written
Definition at line 111 of file GenericIO.tpp.
◆ flushASCII() [3/9]
void bitpit::genericIO::flushASCII | ( | std::fstream & | str, |
const std::vector< data_T > & | data ) |
Writes a vector of POD data type to file stream in ascii format using scientific format on a single line
- Template Parameters
-
data_T type of POD data
- Parameters
-
[in] str file stream [in] data data to be written
Definition at line 55 of file GenericIO.tpp.
◆ flushASCII() [4/9]
void bitpit::genericIO::flushASCII | ( | std::fstream & | str, |
const uint8_t & | data ) |
Writes uint_8 data as formatted integer
- Parameters
-
[in] str file stream to be copied; file needs already to be opened [in] data data to be written
Definition at line 37 of file GenericIO.cpp.
◆ flushASCII() [5/9]
void bitpit::genericIO::flushASCII | ( | std::fstream & | str, |
const uint8_t & | data ) |
Writes uint_8 data as formatted integer
- Parameters
-
[in] str file stream to be copied; file needs already to be opened [in] data data to be written
Definition at line 37 of file GenericIO.cpp.
◆ flushASCII() [6/9]
void bitpit::genericIO::flushASCII | ( | std::fstream & | str, |
int | elements_per_line, | ||
const PiercedVector< data_T > & | data, | ||
bool | writeIndex ) |
Writes a bitpit::PiercedVector file stream in ascii format. It assumes that flushASCIIY is available for data_T
- Template Parameters
-
data_T type data
- Parameters
-
[in] str file stream [in] elements_per_line number of entries per line [in] data data to be written [in] writeIndex if indices should be written too
Definition at line 210 of file GenericIO.tpp.
◆ flushASCII() [7/9]
void bitpit::genericIO::flushASCII | ( | std::fstream & | str, |
int | elements_per_line, | ||
const data_T * | data, | ||
int | nr ) |
Writes a C array of POD data type to file stream in ascii format using scientific format putting a fixed number of elements per line
- Template Parameters
-
data_T type of POD data
- Parameters
-
[in] str file stream [in] elements_per_line number of entries per line [in] data data to be written [in] nr size of the C array
Definition at line 168 of file GenericIO.tpp.
◆ flushASCII() [8/9]
void bitpit::genericIO::flushASCII | ( | std::fstream & | str, |
int | elements_per_line, | ||
const std::array< data_T, d > & | data ) |
Writes a std::array of POD data type to file stream in ascii format using scientific format putting a fixed number of elements per line
- Template Parameters
-
data_T type of POD data d size of array
- Parameters
-
[in] str file stream [in] elements_per_line number of entries per line [in] data data to be written
Definition at line 125 of file GenericIO.tpp.
◆ flushASCII() [9/9]
void bitpit::genericIO::flushASCII | ( | std::fstream & | str, |
int | elements_per_line, | ||
const std::vector< data_T > & | data ) |
Writes a vector of POD data type to file stream in ascii format using scientific format putting a fixed number of elements per line
- Template Parameters
-
data_T type of POD data
- Parameters
-
[in] str file stream [in] elements_per_line number of entries per line [in] data data to be written
Definition at line 68 of file GenericIO.tpp.
◆ flushBINARY() [1/7]
void bitpit::genericIO::flushBINARY | ( | std::fstream & | str, |
const PiercedVector< data_T > & | data, | ||
bool | writeIndex ) |
Writes a bitpit::PiercedVector file stream in binary format. It assumes that flushBINARY is available for data_T
- Template Parameters
-
data_T type data
- Parameters
-
[in] str file stream [in] data data to be written [in] writeIndex if indices should be written
Definition at line 358 of file GenericIO.tpp.
◆ flushBINARY() [2/7]
void bitpit::genericIO::flushBINARY | ( | std::fstream & | str, |
const data_T & | data ) |
Writes a POD data type to file stream in binary format. The function makes uses of memory contigiuty.
- Template Parameters
-
data_T type of POD data
- Parameters
-
[in] str file stream [in] data data to be written
Definition at line 260 of file GenericIO.tpp.
◆ flushBINARY() [3/7]
void bitpit::genericIO::flushBINARY | ( | std::fstream & | str, |
const data_T * | data, | ||
int | nr ) |
Writes a C array of POD data type to file stream in binary format
- Template Parameters
-
data_T type of POD data
- Parameters
-
[in] str file stream [in] data data to be written [in] nr size of the C array
Definition at line 341 of file GenericIO.tpp.
◆ flushBINARY() [4/7]
void bitpit::genericIO::flushBINARY | ( | std::fstream & | str, |
const std::array< data_T, d > & | data ) |
Writes a std::array of POD data type to file stream in binary format
- Template Parameters
-
data_T type of POD data d size of the array
- Parameters
-
[in] str file stream [in] data data to be written
Definition at line 325 of file GenericIO.tpp.
◆ flushBINARY() [5/7]
void bitpit::genericIO::flushBINARY | ( | std::fstream & | str, |
const std::vector< data_T > & | data ) |
Writes a std::vector of POD data type to file stream in binary format. The function makes uses of memory contigiuty.
- Template Parameters
-
data_T type of POD data
- Parameters
-
[in] str file stream [in] data data to be written
Definition at line 276 of file GenericIO.tpp.
◆ flushBINARY() [6/7]
void bitpit::genericIO::flushBINARY | ( | std::fstream & | str, |
const std::vector< std::array< data_T, d > > & | data ) |
Writes a std::vector<std::array> of POD data type to file stream in binary format. The function makes uses of memory contigiuty.
- Template Parameters
-
data_T type of POD data d size of the array
- Parameters
-
[in] str file stream [in] data data to be written
Definition at line 308 of file GenericIO.tpp.
◆ flushBINARY() [7/7]
void bitpit::genericIO::flushBINARY | ( | std::fstream & | str, |
const std::vector< std::vector< data_T > > & | data ) |
Writes a std::vector<std::vector> of POD data type to file stream in binary format.
- Template Parameters
-
data_T type of POD data
- Parameters
-
[in] str file stream [in] data data to be written
Definition at line 292 of file GenericIO.tpp.
◆ lineStream() [1/4]
void bitpit::genericIO::lineStream | ( | std::fstream & | str, |
data_T & | data ) |
Reads one line into templated data type. Relies on operator ">>" of the templated data type. In case the information on the line is not sufficient or exceeds the data type an error message is displayed
- Template Parameters
-
data_T type of POD data
- Parameters
-
[in] str file stream [in] data data to be written
Definition at line 383 of file GenericIO.tpp.
◆ lineStream() [2/4]
void bitpit::genericIO::lineStream | ( | std::fstream & | str, |
data_T * | data, | ||
int | nr ) |
Reads one line into C array of templated data type and given size. Relies on operator ">>" of the templated data type. The information on the line should fit exactly the size . If not an error message is displayed log::cout()
- Template Parameters
-
data_T type of POD data
- Parameters
-
[in] str file stream [in] data data to be written [in] nr number of elements to be read
Definition at line 505 of file GenericIO.tpp.
◆ lineStream() [3/4]
void bitpit::genericIO::lineStream | ( | std::fstream & | str, |
std::array< data_T, d > & | data ) |
Reads one line into std::array of templated data type and templated size Relies on operator ">>" of the templated data type. The information on the line should fit exactly the size of the array. If not an error message is displayed log::cout()
- Template Parameters
-
data_T type of POD data d size of std::array
- Parameters
-
[in] str file stream [in] data data to be written
Definition at line 465 of file GenericIO.tpp.
◆ lineStream() [4/4]
void bitpit::genericIO::lineStream | ( | std::fstream & | str, |
std::vector< data_T > & | data ) |
Reads one line into std::vector of templated data type. Relies on operator ">>" of the templated data type. In case data.size() == 0, data will be resized to match all information available on the line. Otherwise the information on the line should fit exactly the size of data. If not an error message is displayed log::cout()
- Template Parameters
-
data_T type of POD data
- Parameters
-
[in] str file stream [in] data data to be written
Definition at line 423 of file GenericIO.tpp.
