Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:21

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