Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:31

0001 #ifndef binary_ifstream_H
0002 #define binary_ifstream_H
0003 
0004 #include <string>
0005 #include <cstdio>
0006 #include "FWCore/Utilities/interface/Visibility.h"
0007 
0008 namespace magneticfield::interpolation {
0009   class binary_ifstream {
0010   public:
0011     explicit binary_ifstream(const char* name);
0012     explicit binary_ifstream(const std::string& name);
0013 
0014     binary_ifstream(const binary_ifstream&) = delete;
0015     binary_ifstream(binary_ifstream&&);
0016     binary_ifstream& operator=(const binary_ifstream&) = delete;
0017     binary_ifstream& operator=(binary_ifstream&&);
0018 
0019     ~binary_ifstream();
0020 
0021     binary_ifstream& operator>>(char& n);
0022     binary_ifstream& operator>>(unsigned char& n);
0023 
0024     binary_ifstream& operator>>(short& n);
0025     binary_ifstream& operator>>(unsigned short& n);
0026 
0027     binary_ifstream& operator>>(int& n);
0028     binary_ifstream& operator>>(unsigned int& n);
0029 
0030     binary_ifstream& operator>>(long& n);
0031     binary_ifstream& operator>>(unsigned long& n);
0032 
0033     binary_ifstream& operator>>(float& n);
0034     binary_ifstream& operator>>(double& n);
0035 
0036     binary_ifstream& operator>>(bool& n);
0037     binary_ifstream& operator>>(std::string& n);
0038 
0039     void close();
0040 
0041     /// stream state checking
0042     bool good() const;
0043     bool eof() const;
0044     bool fail() const;
0045     bool bad() const;
0046     bool operator!() const;
0047     operator bool() const;
0048 
0049     long tellg();
0050     binary_ifstream& seekg(long);
0051 
0052   private:
0053     FILE* file_;
0054 
0055     void init(const char* name);
0056   };
0057 }  // namespace magneticfield::interpolation
0058 #endif