Binary Infile Class. More...
#include <itpp/base/binfile.h>
Public Types | |
enum | endian { l_endian, b_endian } |
Definition of the endian data type. More... | |
Public Member Functions | |
bifstream (const std::string &name, endian e=b_endian) | |
Class constructor that opens a file and sets the endianity. | |
bifstream () | |
Class Constructor. | |
~bifstream () | |
Class Destructor. | |
void | open (const std::string &name, endian e=b_endian) |
Open a file for reading and set the endianity. | |
int | length () |
Returns the length in bytes of the file. | |
bifstream & | operator>> (char &a) |
Reads a signed char variable from the binary output file. | |
bifstream & | operator>> (unsigned char &a) |
Reads an unsigned char variable from the binary output file. | |
bifstream & | operator>> (int16_t &a) |
Reads a 16-bit signed integer variable from the binary output file. | |
bifstream & | operator>> (uint16_t &a) |
Reads a 16-bit unsigned integer variable from the binary output file. | |
bifstream & | operator>> (int32_t &a) |
Reads a 32-bit signed integer variable from the binary output file. | |
bifstream & | operator>> (uint32_t &a) |
Reads a 32-bit unsigned integer variable from the binary output file. | |
bifstream & | operator>> (int64_t &a) |
Reads a 64-bit signed integer variable from the binary output file. | |
bifstream & | operator>> (uint64_t &a) |
Reads a 64-bit unsigned ingeger variable from the binary output file. | |
bifstream & | operator>> (float &a) |
Reads a float variable from the binary output file. | |
bifstream & | operator>> (double &a) |
Reads a double variable from the binary output file. | |
bifstream & | operator>> (char *a) |
Reads a char* string from the binary output file. | |
bifstream & | operator>> (std::string &a) |
Reads a string variable from the binary output file. | |
endian | get_endianity () const |
Returns the endianity of the class. | |
endian | get_native_endianity () const |
Returns the native endianity for this computer architecture. | |
void | set_endianity (endian e) |
Set the endianity for this class. | |
void | set_native_endianity () |
Set the endianity of this class to the native endianity for this computer architecture. | |
Protected Attributes | |
bool | switch_endianity |
Indicates if the endianity of the processed data needs to be changed. | |
endian | native_endianity |
The native endianity for this computer architecture. |
Binary Infile Class.
Definition at line 187 of file binfile.h.
enum itpp::bfstream_base::endian [inherited] |
Definition of the endian data type.
The Endianness defines the order in which multibyte numbers are stored in the file. The two orders are called "Little Endian" (l_endian
) and "Big Endian" (b_endian
).
"Little Endian" means that the low-order byte of the number is stored at the lowest address (i.e. the little end comes first). "Big Endian" means that the high-order byte of the number is stored in memory at the lowest address (i.e. the big end comes first)
itpp::bifstream::bifstream | ( | const std::string & | name, | |
endian | e = b_endian | |||
) |
Class constructor that opens a file and sets the endianity.
name | The name of the file to open | |
e | Defines the endianity of the class. Possible values are l_endian for "Little Endian" or b_endian for "Big Endian". The default value is b_endian . |
Definition at line 189 of file binfile.cpp.
void itpp::bifstream::open | ( | const std::string & | name, | |
endian | e = b_endian | |||
) |
Open a file for reading and set the endianity.
name | The name of the file to open | |
e | Defines the endianity of the class (default value is b_endian ) |
Definition at line 194 of file binfile.cpp.
References itpp::bfstream_base::native_endianity, and itpp::bfstream_base::switch_endianity.
endian itpp::bfstream_base::get_native_endianity | ( | ) | const [inline, inherited] |
Returns the native endianity for this computer architecture.
Intel processors use "Little Endian" byte ordering while e.g. Motorola processors use "Big Endian" byte ordering.
Definition at line 100 of file binfile.h.
References itpp::bfstream_base::native_endianity.
Referenced by itpp::it_file_old::write_data_header().
Generated on Tue Nov 23 08:45:13 2010 for IT++ by Doxygen 1.6.1