00001 /* 00002 * Use the c++ ifstream to read file 00003 * 00004 * Zhe Wang 00005 * Feb. 10, 2010 @ BNL 00006 * 00007 */ 00008 00009 #ifndef _IF_STREAM_H_ 00010 #define _IF_STREAM_H_ 00011 00012 #include "RawData/IInputStream.h" 00013 #include <fstream> 00014 00015 class IFStream:public IInputStream 00016 { 00017 public: 00018 IFStream() {}; 00019 IFStream( const char * filename ); 00020 virtual ~IFStream(); 00021 00023 void close ( ); 00024 void open ( const char * filename ); 00025 bool is_open ( ) const; 00026 bool good ( ) const; 00027 00028 bool operator ! ( ) const; 00029 00030 IFStream& read ( char* s, int n ); 00031 IFStream& ignore ( int n = 1 ); 00032 00033 private: 00034 mutable std::ifstream m_ifstream; 00035 }; 00036 00037 #endif // _IF_STREAM_H_ 00038 00039 00040 // Local Variables: ** 00041 // c-basic-offset:2 ** 00042 // End: **