CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTTPGLutFile Class Reference

#include <DTTPGLutFile.h>

List of all members.

Public Member Functions

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

Private Attributes

std::string m_file
std::ifstream m_fin

Detailed Description

Auxiliary class to handle Look-up table files

Date:
2007/10/23 13:44:22
Revision:
1.1
Author:
N. Neumeister CERN EP

Definition at line 37 of file DTTPGLutFile.h.


Constructor & Destructor Documentation

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

constructor

DTTPGLutFile::DTTPGLutFile ( const DTTPGLutFile in)

copy constructor

Definition at line 45 of file DTTPGLutFile.cc.

: m_file(in.m_file) {}
DTTPGLutFile::~DTTPGLutFile ( ) [virtual]

destructor

Definition at line 52 of file DTTPGLutFile.cc.

{}

Member Function Documentation

bool DTTPGLutFile::bad ( ) [inline]

return status of file stream

Definition at line 63 of file DTTPGLutFile.h.

References m_fin.

{ return m_fin.bad(); }
void DTTPGLutFile::close ( void  ) [inline]

close file

Definition at line 66 of file DTTPGLutFile.h.

References m_fin.

Referenced by DTTracoLUTs::load().

{ m_fin.close(); }
std::string DTTPGLutFile::getName ( void  ) const [inline]

return filename

Definition at line 54 of file DTTPGLutFile.h.

References m_file.

{ return m_file; }
bool DTTPGLutFile::good ( ) [inline]

return status of file stream

Definition at line 60 of file DTTPGLutFile.h.

References m_fin.

{ return m_fin.good(); }
void DTTPGLutFile::ignoreLines ( int  n)

read and ignore n lines from file

Definition at line 81 of file DTTPGLutFile.cc.

References i, m_fin, and n.

                                    {

  char buf[256];
  for ( int i = 0; i < n; i++ ) m_fin.getline(buf,256);

}
int DTTPGLutFile::open ( )

open file

Definition at line 66 of file DTTPGLutFile.cc.

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

Referenced by DTTracoLUTs::load().

                       {

  const char* file_name = m_file.c_str();
  m_fin.open(file_name,ios::in);
  if ( !m_fin ) {
    cout << "can not open file : " << file_name << endl;
    return -1;
  }
  else  {
    return 0;
  }

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

assignment operator

Definition at line 58 of file DTTPGLutFile.cc.

References m_file.

                                                             {

  m_file = lut.m_file;
  return *this;

}
int DTTPGLutFile::readHex ( )

read one hex from file

Definition at line 98 of file DTTPGLutFile.cc.

References m_fin, and tmp.

Referenced by DTTracoLUTs::load().

                          { 

  int tmp = 0;
  m_fin >> hex >> tmp; 
  return tmp;
    
}
int DTTPGLutFile::readInteger ( )

read one integer from file

Definition at line 89 of file DTTPGLutFile.cc.

References m_fin, and tmp.

                              { 

  int tmp = 0;
  m_fin >> tmp; 
  return tmp;

}
string DTTPGLutFile::readString ( )

read one string from file

Definition at line 107 of file DTTPGLutFile.cc.

References m_fin, and tmp.

                                {

  string tmp;
  m_fin >> tmp;
  return tmp;

}

Member Data Documentation

std::string DTTPGLutFile::m_file [private]

Definition at line 83 of file DTTPGLutFile.h.

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

std::ifstream DTTPGLutFile::m_fin [private]

Definition at line 82 of file DTTPGLutFile.h.

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