Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:07

0001 //-------------------------------------------------
0002 //
0003 /**  \class DTTPGLutFile
0004  *
0005  *   Auxiliary class to handle Look-up table files
0006  *
0007  *
0008  *
0009  *   \author   N. Neumeister            CERN EP
0010  */
0011 //
0012 //--------------------------------------------------
0013 #ifndef DTTPG_LUT_FILE_H
0014 #define DTTPG_LUT_FILE_H
0015 
0016 //---------------
0017 // C++ Headers --
0018 //---------------
0019 
0020 #include <fstream>
0021 #include <string>
0022 
0023 //----------------------
0024 // Base Class Headers --
0025 //----------------------
0026 
0027 //------------------------------------
0028 // Collaborating Class Declarations --
0029 //------------------------------------
0030 
0031 //              ---------------------
0032 //              -- Class Interface --
0033 //              ---------------------
0034 
0035 class DTTPGLutFile {
0036 public:
0037   /// constructor
0038   DTTPGLutFile(const std::string name = "");
0039 
0040   /// copy constructor
0041   DTTPGLutFile(const DTTPGLutFile &);
0042 
0043   /// destructor
0044   virtual ~DTTPGLutFile();
0045 
0046   /// assignment operator
0047   DTTPGLutFile &operator=(const DTTPGLutFile &);
0048 
0049   /// return filename
0050   inline std::string getName() const { return m_file; }
0051 
0052   /// open file
0053   int open();
0054 
0055   /// return status of file stream
0056   inline bool good() { return m_fin.good(); }
0057 
0058   /// return status of file stream
0059   inline bool bad() { return m_fin.bad(); }
0060 
0061   /// close file
0062   inline void close() { m_fin.close(); }
0063 
0064   /// read and ignore n lines from file
0065   void ignoreLines(int n);
0066 
0067   /// read one integer from file
0068   int readInteger();
0069 
0070   /// read one hex from file
0071   int readHex();
0072 
0073   /// read one string from file
0074   std::string readString();
0075 
0076 private:
0077   std::ifstream m_fin;  // input file stream
0078   std::string m_file;   // file name
0079 };
0080 
0081 #endif