IT++ Logo Newcom Logo

itpp::bfstream Class Reference
[IT++ File Format]

Binary in/out-file Class. More...

#include <itpp/base/binfile.h>

Inheritance diagram for itpp::bfstream:

itpp::bfstream_base List of all members.

Public Types

enum  endian { l_endian, b_endian }
 Definition of the endian data type. More...

Public Member Functions

 bfstream (const std::string &name, endian e=b_endian)
 Class constructor that opens a file and sets the endianity.
 bfstream ()
 Class Constructor.
 ~bfstream ()
 Class Destructor.
void open (const std::string &name, bool trunc=false, endian e=b_endian)
 Open a file for reading and writing and set the endianity.
void open_readonly (const std::string &name, endian e=b_endian)
 Open a file for reading only and set the endianity.
long length ()
 Returns the length in bytes of the file.
bfstreamoperator<< (char a)
 Writes a char variable to the binary file.
bfstreamoperator<< (const class bin &a)
 Writes a bin variable to the binary file.
bfstreamoperator<< (int a)
 Writes an int variable to the binary file.
bfstreamoperator<< (unsigned int a)
 Writes an unsigned int variable to the binary file.
bfstreamoperator<< (short a)
 Writes a short variable to the binary file.
bfstreamoperator<< (unsigned short a)
 Writes an unsigned short variable to the binary file.
bfstreamoperator<< (float a)
 Writes a float variable to the binary file.
bfstreamoperator<< (double a)
 Writes a double variable to the binary file.
bfstreamoperator<< (long int a)
 Writes a long int variable to the binary file.
bfstreamoperator<< (unsigned long int a)
 Writes an unsigned long int variable to the binary file.
bfstreamoperator<< (const char *a)
 ACTION: ADD DOCUMENTATION FOR THIS MEMBER!!!!!!!!!!
bfstreamoperator<< (const std::string &a)
 Writes a string variable to the binary file.
bfstreamoperator>> (char &a)
 Reads a char variable from the binary file.
bfstreamoperator>> (class bin &a)
 Reads a bin variable from the binary file.
bfstreamoperator>> (int &a)
 Reads an int variable from the binary file.
bfstreamoperator>> (unsigned int &a)
 Reads an unsigned int variable from the binary file.
bfstreamoperator>> (short int &a)
 Reads a short int variable from the binary file.
bfstreamoperator>> (unsigned short int &a)
 Reads an unsigned short int variable from the binary file.
bfstreamoperator>> (float &a)
 Reads a float variable from the binary file.
bfstreamoperator>> (double &a)
 Reads a double variable from the binary file.
bfstreamoperator>> (long int &a)
 Reads a long int variable from the binary file.
bfstreamoperator>> (unsigned long int &a)
 Reads an unsigned long int variable from the binary file.
bfstreamoperator>> (char *a)
 ACTION: ADD DOCUMENTATION FOR THIS MEMBER!!!!!!!!!!
bfstreamoperator>> (std::string &a)
 Reads a string variable from the binary file.
endian get_endianity () const
 Returns the endianity of the class (l_endian or b_endian ).
endian get_native_endianity () const
 Returns the native endianity for this computer architecture (l_endian or b_endian ).
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

endian endianity
 The endianity used by this class.
endian native_endianity
 The native endianity for this computer architecture.

Detailed Description

Binary in/out-file Class.

Definition at line 227 of file binfile.h.


Member Enumeration Documentation

enum itpp::bfstream_base::endian [inherited]

Definition of the endian data type.

The Endian 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 adress (i.e. the little end comes first). "Big Endian" means that the high-order byte of the number is stored in memory at the highest address (i.e. the big end comes first)

Enumerator:
l_endian 
b_endian 

Definition at line 66 of file binfile.h.


Constructor & Destructor Documentation

itpp::bfstream::bfstream ( const std::string &  name,
endian  e = b_endian 
)

Class constructor that opens a file and sets the endianity.

Parameters:
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 459 of file binfile.cpp.

itpp::bfstream::bfstream (  ) 

Class Constructor.

Definition at line 464 of file binfile.cpp.

itpp::bfstream::~bfstream (  )  [inline]

Class Destructor.

Definition at line 241 of file binfile.h.


Member Function Documentation

void itpp::bfstream::open ( const std::string &  name,
bool  trunc = false,
endian  e = b_endian 
)

Open a file for reading and writing and set the endianity.

Parameters:
name The name of the file to open
trunc ACTION: Add documentation for this parameter (default value is false)
e Defines the endianity of the class (default value is b_endian )

Definition at line 469 of file binfile.cpp.

References itpp::bfstream_base::endianity.

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

void itpp::bfstream::open_readonly ( const std::string &  name,
endian  e = b_endian 
)

Open a file for reading only and set the endianity.

Parameters:
name The name of the file to open
e Defines the endianity of the class (default value is b_endian )

Definition at line 481 of file binfile.cpp.

References itpp::bfstream_base::endianity.

Referenced by itpp::it_ifile::open().

long itpp::bfstream::length (  ) 

Returns the length in bytes of the file.

Definition at line 487 of file binfile.cpp.

bfstream & itpp::bfstream::operator<< ( char  a  ) 

Writes a char variable to the binary file.

Definition at line 497 of file binfile.cpp.

bfstream & itpp::bfstream::operator<< ( const class bin a  ) 

Writes a bin variable to the binary file.

Definition at line 503 of file binfile.cpp.

bfstream & itpp::bfstream::operator<< ( int  a  ) 

Writes an int variable to the binary file.

Definition at line 509 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator<< ( unsigned int  a  ) 

Writes an unsigned int variable to the binary file.

Definition at line 524 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator<< ( short  a  ) 

Writes a short variable to the binary file.

Definition at line 539 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator<< ( unsigned short  a  ) 

Writes an unsigned short variable to the binary file.

Definition at line 553 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator<< ( float  a  ) 

Writes a float variable to the binary file.

Definition at line 566 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator<< ( double  a  ) 

Writes a double variable to the binary file.

Definition at line 581 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator<< ( long int  a  ) 

Writes a long int variable to the binary file.

Definition at line 621 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator<< ( unsigned long int  a  ) 

Writes an unsigned long int variable to the binary file.

Definition at line 636 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator<< ( const char *  a  ) 

ACTION: ADD DOCUMENTATION FOR THIS MEMBER!!!!!!!!!!

Definition at line 651 of file binfile.cpp.

bfstream & itpp::bfstream::operator<< ( const std::string &  a  ) 

Writes a string variable to the binary file.

Definition at line 657 of file binfile.cpp.

bfstream & itpp::bfstream::operator>> ( char &  a  ) 

Reads a char variable from the binary file.

Definition at line 663 of file binfile.cpp.

bfstream & itpp::bfstream::operator>> ( class bin a  ) 

Reads a bin variable from the binary file.

Definition at line 669 of file binfile.cpp.

bfstream & itpp::bfstream::operator>> ( int &  a  ) 

Reads an int variable from the binary file.

Definition at line 677 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator>> ( unsigned int &  a  ) 

Reads an unsigned int variable from the binary file.

Definition at line 692 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator>> ( short int &  a  ) 

Reads a short int variable from the binary file.

Definition at line 707 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator>> ( unsigned short int &  a  ) 

Reads an unsigned short int variable from the binary file.

Definition at line 720 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator>> ( float &  a  ) 

Reads a float variable from the binary file.

Definition at line 733 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator>> ( double &  a  ) 

Reads a double variable from the binary file.

Definition at line 748 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator>> ( long int &  a  ) 

Reads a long int variable from the binary file.

Definition at line 788 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator>> ( unsigned long int &  a  ) 

Reads an unsigned long int variable from the binary file.

Definition at line 803 of file binfile.cpp.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.

bfstream & itpp::bfstream::operator>> ( char *  a  ) 

ACTION: ADD DOCUMENTATION FOR THIS MEMBER!!!!!!!!!!

Definition at line 818 of file binfile.cpp.

bfstream & itpp::bfstream::operator>> ( std::string &  a  ) 

Reads a string variable from the binary file.

Definition at line 824 of file binfile.cpp.

endian itpp::bfstream_base::get_endianity (  )  const [inline, inherited]

Returns the endianity of the class (l_endian or b_endian ).

Definition at line 78 of file binfile.h.

References itpp::bfstream_base::endianity.

endian itpp::bfstream_base::get_native_endianity (  )  const [inline, inherited]

Returns the native endianity for this computer architecture (l_endian or b_endian ).

Intel processors use "Little Endian" byte ordering while e.g. Motorola processors use "Big Endian" byte ordering.

Definition at line 85 of file binfile.h.

References itpp::bfstream_base::native_endianity.

Referenced by itpp::it_file::write_data_header().

void itpp::bfstream_base::set_endianity ( endian  e  )  [inline, inherited]

Set the endianity for this class.

Definition at line 90 of file binfile.h.

References itpp::bfstream_base::endianity.

Referenced by itpp::it_ifile::read_data_header(), and itpp::it_file::write_data_header_here().

void itpp::bfstream_base::set_native_endianity (  )  [inline, inherited]

Set the endianity of this class to the native endianity for this computer architecture.

Definition at line 95 of file binfile.h.

References itpp::bfstream_base::endianity, and itpp::bfstream_base::native_endianity.


Member Data Documentation

endian itpp::bfstream_base::endianity [protected, inherited]

The endianity used by this class.

Definition at line 99 of file binfile.h.

Referenced by itpp::bfstream_base::bfstream_base(), itpp::bfstream_base::get_endianity(), open(), itpp::bifstream::open(), itpp::bofstream::open(), open_readonly(), operator<<(), itpp::bofstream::operator<<(), operator>>(), itpp::bifstream::operator>>(), itpp::it_ifile::read_data_header(), itpp::bfstream_base::set_endianity(), itpp::bfstream_base::set_native_endianity(), and itpp::it_file::write_data_header_here().

endian itpp::bfstream_base::native_endianity [protected, inherited]

The native endianity for this computer architecture.

Definition at line 101 of file binfile.h.

Referenced by itpp::bfstream_base::bfstream_base(), itpp::bfstream_base::get_native_endianity(), operator<<(), itpp::bofstream::operator<<(), operator>>(), itpp::bifstream::operator>>(), and itpp::bfstream_base::set_native_endianity().


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

Generated on Sat Aug 25 23:37:29 2007 for IT++ by Doxygen 1.5.2