CMS 3D CMS Logo

DTTPGLutFile.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: DTTPGLutFile
4 //
5 // Description: Auxiliary class for
6 // Look-up table files
7 //
8 //
9 //
10 // Author :
11 // N. Neumeister CERN EP
12 //
13 //--------------------------------------------------
14 
15 //-----------------------
16 // This Class's Header --
17 //-----------------------
18 
20 
21 //---------------
22 // C++ Headers --
23 //---------------
24 
25 #include <iostream>
26 
27 using namespace std;
28 
29 //-------------------------------
30 // Collaborating Class Headers --
31 //-------------------------------
32 
33 // --------------------------------
34 // class DTTPGLutFile
35 //---------------------------------
36 
37 //----------------
38 // Constructors --
39 //----------------
40 
41 DTTPGLutFile::DTTPGLutFile(const string name) : m_file(name) {}
42 
43 DTTPGLutFile::DTTPGLutFile(const DTTPGLutFile &in) : m_file(in.m_file) {}
44 
45 //--------------
46 // Destructor --
47 //--------------
48 
50 
51 //--------------
52 // Operations --
53 //--------------
54 
56  m_file = lut.m_file;
57  return *this;
58 }
59 
61  const char *file_name = m_file.c_str();
62  m_fin.open(file_name, ios::in);
63  if (!m_fin) {
64  cout << "can not open file : " << file_name << endl;
65  return -1;
66  } else {
67  return 0;
68  }
69 }
70 
72  char buf[256];
73  for (int i = 0; i < n; i++)
74  m_fin.getline(buf, 256);
75 }
76 
78  int tmp = 0;
79  m_fin >> tmp;
80  return tmp;
81 }
82 
84  int tmp = 0;
85  m_fin >> hex >> tmp;
86  return tmp;
87 }
88 
90  string tmp;
91  m_fin >> tmp;
92  return tmp;
93 }
virtual ~DTTPGLutFile()
destructor
Definition: DTTPGLutFile.cc:49
void ignoreLines(int n)
read and ignore n lines from file
Definition: DTTPGLutFile.cc:71
std::string readString()
read one string from file
Definition: DTTPGLutFile.cc:89
std::string m_file
Definition: DTTPGLutFile.h:78
DTTPGLutFile & operator=(const DTTPGLutFile &)
assignment operator
Definition: DTTPGLutFile.cc:55
DTTPGLutFile(const std::string name="")
constructor
int readHex()
read one hex from file
Definition: DTTPGLutFile.cc:83
std::ifstream m_fin
Definition: DTTPGLutFile.h:77
int readInteger()
read one integer from file
Definition: DTTPGLutFile.cc:77
int open()
open file
Definition: DTTPGLutFile.cc:60
tmp
align.sh
Definition: createJobs.py:716