CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/L1Trigger/DTUtilities/src/DTTPGLutFile.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class: DTTPGLutFile
00004 //
00005 //   Description: Auxiliary class for 
00006 //                Look-up table files
00007 //
00008 //
00009 //   $Date: 2007/10/23 13:44:23 $
00010 //   $Revision: 1.1 $
00011 //
00012 //   Author :
00013 //   N. Neumeister            CERN EP
00014 //
00015 //--------------------------------------------------
00016 
00017 //-----------------------
00018 // This Class's Header --
00019 //-----------------------
00020 
00021 #include "L1Trigger/DTUtilities/interface/DTTPGLutFile.h"
00022 
00023 //---------------
00024 // C++ Headers --
00025 //---------------
00026 
00027 #include <iostream>
00028 
00029 using namespace std;
00030 
00031 //-------------------------------
00032 // Collaborating Class Headers --
00033 //-------------------------------
00034 
00035 // --------------------------------
00036 //       class DTTPGLutFile
00037 //---------------------------------
00038 
00039 //----------------
00040 // Constructors --
00041 //----------------
00042 
00043 DTTPGLutFile::DTTPGLutFile(const string name) : m_file(name) {}
00044 
00045 DTTPGLutFile::DTTPGLutFile(const DTTPGLutFile& in) : m_file(in.m_file) {}
00046 
00047 
00048 //--------------
00049 // Destructor --
00050 //--------------
00051 
00052 DTTPGLutFile::~DTTPGLutFile() {}
00053 
00054 //--------------
00055 // Operations --
00056 //--------------
00057 
00058 DTTPGLutFile& DTTPGLutFile::operator=(const DTTPGLutFile& lut) {
00059 
00060   m_file = lut.m_file;
00061   return *this;
00062 
00063 }
00064 
00065 
00066 int DTTPGLutFile::open() {
00067 
00068   const char* file_name = m_file.c_str();
00069   m_fin.open(file_name,ios::in);
00070   if ( !m_fin ) {
00071     cout << "can not open file : " << file_name << endl;
00072     return -1;
00073   }
00074   else  {
00075     return 0;
00076   }
00077 
00078 }
00079 
00080 
00081 void DTTPGLutFile::ignoreLines(int n) {
00082 
00083   char buf[256];
00084   for ( int i = 0; i < n; i++ ) m_fin.getline(buf,256);
00085 
00086 }
00087 
00088 
00089 int DTTPGLutFile::readInteger() { 
00090 
00091   int tmp = 0;
00092   m_fin >> tmp; 
00093   return tmp;
00094 
00095 }
00096 
00097 
00098 int DTTPGLutFile::readHex() { 
00099 
00100   int tmp = 0;
00101   m_fin >> hex >> tmp; 
00102   return tmp;
00103     
00104 }
00105 
00106 
00107 string DTTPGLutFile::readString() {
00108 
00109   string tmp;
00110   m_fin >> tmp;
00111   return tmp;
00112 
00113 }