#include <MagneticField/Interpolation/src/binary_ifstream.h>
Public Member Functions | |
bool | bad () const |
binary_ifstream (const std::string &name) | |
binary_ifstream (const char *name) | |
void | close () |
bool | eof () const |
bool | fail () const |
bool | good () const |
stream state checking | |
operator bool () const | |
bool | operator! () const |
binary_ifstream & | operator>> (std::string &n) |
binary_ifstream & | operator>> (bool &n) |
binary_ifstream & | operator>> (double &n) |
binary_ifstream & | operator>> (float &n) |
binary_ifstream & | operator>> (unsigned long &n) |
binary_ifstream & | operator>> (long &n) |
binary_ifstream & | operator>> (unsigned int &n) |
binary_ifstream & | operator>> (int &n) |
binary_ifstream & | operator>> (unsigned short &n) |
binary_ifstream & | operator>> (short &n) |
binary_ifstream & | operator>> (unsigned char &n) |
binary_ifstream & | operator>> (char &n) |
~binary_ifstream () | |
Private Member Functions | |
void | init (const char *name) |
Private Attributes | |
FILE * | file_ |
Definition at line 7 of file binary_ifstream.h.
binary_ifstream::binary_ifstream | ( | const char * | name | ) | [explicit] |
binary_ifstream::binary_ifstream | ( | const std::string & | name | ) | [explicit] |
binary_ifstream::~binary_ifstream | ( | ) |
Definition at line 28 of file binary_ifstream.cc.
References close().
00029 { 00030 close(); 00031 }
Definition at line 99 of file binary_ifstream.cc.
References fail().
Referenced by good(), and operator!().
00099 {return fail();}
Definition at line 32 of file binary_ifstream.cc.
References file_.
Referenced by ~binary_ifstream().
Definition at line 88 of file binary_ifstream.cc.
References file_.
Referenced by good(), and operator!().
00089 { 00090 return feof( file_); 00091 }
bool binary_ifstream::fail | ( | ) | const |
Definition at line 93 of file binary_ifstream.cc.
References file_.
Referenced by bad(), and operator!().
stream state checking
Definition at line 83 of file binary_ifstream.cc.
Referenced by operator bool().
void binary_ifstream::init | ( | const char * | name | ) | [private] |
Definition at line 18 of file binary_ifstream.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and file_.
Referenced by binary_ifstream().
00019 { 00020 file_ = fopen( name, "rb"); 00021 if (file_ == 0) { 00022 std::cout << "file " << name << " cannot be opened for reading" 00023 << std::endl; 00024 throw binary_ifstream_error(); 00025 } 00026 }
Definition at line 105 of file binary_ifstream.cc.
References good().
00105 { 00106 return good(); 00107 }
bool binary_ifstream::operator! | ( | ) | const |
binary_ifstream & binary_ifstream::operator>> | ( | std::string & | n | ) |
Definition at line 72 of file binary_ifstream.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), file_, and tmp.
00072 { 00073 unsigned int nchar; 00074 (*this) >> nchar; 00075 char* tmp = new char[nchar+1]; 00076 unsigned int nread = fread( tmp, 1, nchar, file_); 00077 if (nread != nchar) std::cout << "binary_ifstream error: read less then expected " << std::endl; 00078 n.assign( tmp, nread); 00079 delete[] tmp; 00080 return *this; 00081 }
binary_ifstream& binary_ifstream::operator>> | ( | bool & | n | ) |
binary_ifstream & binary_ifstream::operator>> | ( | double & | n | ) |
binary_ifstream & binary_ifstream::operator>> | ( | float & | n | ) |
binary_ifstream & binary_ifstream::operator>> | ( | unsigned long & | n | ) |
binary_ifstream & binary_ifstream::operator>> | ( | long & | n | ) |
binary_ifstream & binary_ifstream::operator>> | ( | unsigned int & | n | ) |
binary_ifstream & binary_ifstream::operator>> | ( | int & | n | ) |
binary_ifstream & binary_ifstream::operator>> | ( | unsigned short & | n | ) |
binary_ifstream & binary_ifstream::operator>> | ( | short & | n | ) |
binary_ifstream & binary_ifstream::operator>> | ( | unsigned char & | n | ) |
binary_ifstream & binary_ifstream::operator>> | ( | char & | n | ) |
FILE* binary_ifstream::file_ [private] |
Definition at line 45 of file binary_ifstream.h.
Referenced by close(), eof(), fail(), init(), and operator>>().