CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DTTPGLutFile Class Reference

#include <DTTPGLutFile.h>

Public Member Functions

bool bad ()
 return status of file stream More...
 
void close ()
 close file More...
 
 DTTPGLutFile (const DTTPGLutFile &)
 copy constructor More...
 
 DTTPGLutFile (const std::string name="")
 constructor More...
 
std::string getName () const
 return filename More...
 
bool good ()
 return status of file stream More...
 
void ignoreLines (int n)
 read and ignore n lines from file More...
 
int open ()
 open file More...
 
DTTPGLutFileoperator= (const DTTPGLutFile &)
 assignment operator More...
 
int readHex ()
 read one hex from file More...
 
int readInteger ()
 read one integer from file More...
 
std::string readString ()
 read one string from file More...
 
virtual ~DTTPGLutFile ()
 destructor More...
 

Private Attributes

std::string m_file
 
std::ifstream m_fin
 

Detailed Description

Auxiliary class to handle Look-up table files

Author
N. Neumeister CERN EP

Definition at line 35 of file DTTPGLutFile.h.

Constructor & Destructor Documentation

◆ DTTPGLutFile() [1/2]

DTTPGLutFile::DTTPGLutFile ( const std::string  name = "")

constructor

◆ DTTPGLutFile() [2/2]

DTTPGLutFile::DTTPGLutFile ( const DTTPGLutFile in)

copy constructor

Definition at line 43 of file DTTPGLutFile.cc.

43 : m_file(in.m_file) {}

◆ ~DTTPGLutFile()

DTTPGLutFile::~DTTPGLutFile ( )
virtual

destructor

Definition at line 49 of file DTTPGLutFile.cc.

49 {}

Member Function Documentation

◆ bad()

bool DTTPGLutFile::bad ( )
inline

return status of file stream

Definition at line 59 of file DTTPGLutFile.h.

59 { return m_fin.bad(); }

References m_fin.

◆ close()

void DTTPGLutFile::close ( void  )
inline

close file

Definition at line 62 of file DTTPGLutFile.h.

62 { m_fin.close(); }

References m_fin.

Referenced by esMonitoring.AsyncLineReaderMixin::handle_close(), esMonitoring.FDJsonServer::handle_close(), and DTTracoLUTs::load().

◆ getName()

std::string DTTPGLutFile::getName ( void  ) const
inline

return filename

Definition at line 50 of file DTTPGLutFile.h.

50 { return m_file; }

References m_file.

Referenced by plotting.Plot::draw().

◆ good()

bool DTTPGLutFile::good ( )
inline

return status of file stream

Definition at line 56 of file DTTPGLutFile.h.

56 { return m_fin.good(); }

References m_fin.

◆ ignoreLines()

void DTTPGLutFile::ignoreLines ( int  n)

read and ignore n lines from file

Definition at line 71 of file DTTPGLutFile.cc.

71  {
72  char buf[256];
73  for (int i = 0; i < n; i++)
74  m_fin.getline(buf, 256);
75 }

References visDQMUpload::buf, mps_fire::i, m_fin, and dqmiodumpmetadata::n.

◆ open()

int DTTPGLutFile::open ( )

open file

Definition at line 60 of file DTTPGLutFile.cc.

60  {
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 }

References gather_cfg::cout, contentValuesCheck::file_name, recoMuon::in, m_file, and m_fin.

Referenced by DTTracoLUTs::load().

◆ operator=()

DTTPGLutFile & DTTPGLutFile::operator= ( const DTTPGLutFile lut)

assignment operator

Definition at line 55 of file DTTPGLutFile.cc.

55  {
56  m_file = lut.m_file;
57  return *this;
58 }

References m_file.

◆ readHex()

int DTTPGLutFile::readHex ( )

read one hex from file

Definition at line 83 of file DTTPGLutFile.cc.

83  {
84  int tmp = 0;
85  m_fin >> hex >> tmp;
86  return tmp;
87 }

References m_fin, and createJobs::tmp.

Referenced by DTTracoLUTs::load().

◆ readInteger()

int DTTPGLutFile::readInteger ( )

read one integer from file

Definition at line 77 of file DTTPGLutFile.cc.

77  {
78  int tmp = 0;
79  m_fin >> tmp;
80  return tmp;
81 }

References m_fin, and createJobs::tmp.

◆ readString()

string DTTPGLutFile::readString ( )

read one string from file

Definition at line 89 of file DTTPGLutFile.cc.

89  {
90  string tmp;
91  m_fin >> tmp;
92  return tmp;
93 }

References m_fin, and createJobs::tmp.

Member Data Documentation

◆ m_file

std::string DTTPGLutFile::m_file
private

Definition at line 78 of file DTTPGLutFile.h.

Referenced by getName(), open(), and operator=().

◆ m_fin

std::ifstream DTTPGLutFile::m_fin
private

Definition at line 77 of file DTTPGLutFile.h.

Referenced by bad(), close(), good(), ignoreLines(), open(), readHex(), readInteger(), and readString().

mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
DTTPGLutFile::m_fin
std::ifstream m_fin
Definition: DTTPGLutFile.h:77
gather_cfg.cout
cout
Definition: gather_cfg.py:144
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
contentValuesCheck.file_name
file_name
Definition: contentValuesCheck.py:38
recoMuon::in
Definition: RecoMuonEnumerators.h:6
visDQMUpload.buf
buf
Definition: visDQMUpload.py:160
DTTPGLutFile::m_file
std::string m_file
Definition: DTTPGLutFile.h:78