CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
GzInputStream Struct Reference

Public Member Functions

 GzInputStream (const char *file)
 
 GzInputStream (const char *file)
 
 operator bool () const
 
 operator bool () const
 
void readLine ()
 
void readLine ()
 
 ~GzInputStream ()
 
 ~GzInputStream ()
 

Public Attributes

char buffer [256]
 
bool eof
 
gzFile gzf
 
std::istringstream iss
 

Detailed Description

Definition at line 93 of file EcalEBTrigPrimPhase2ESProducer.cc.

Constructor & Destructor Documentation

◆ GzInputStream() [1/2]

GzInputStream::GzInputStream ( const char *  file)
inline

Definition at line 98 of file EcalEBTrigPrimPhase2ESProducer.cc.

References eof, geometryDiff::file, gzf, and readLine().

98  : eof(false) {
99  gzf = gzopen(file, "rb");
100  edm::LogInfo("EcalEBTrigPrimPhase2ESProducer") << " New weight file " << file;
101  if (gzf == Z_NULL) {
102  eof = true;
103  edm::LogWarning("EcalEBTrigPrimPhase2ESProducer") << "Database file " << file << " not found!!!";
104  } else
105  readLine();
106  }
Log< level::Info, false > LogInfo
Log< level::Warning, false > LogWarning

◆ ~GzInputStream() [1/2]

GzInputStream::~GzInputStream ( )
inline

Definition at line 115 of file EcalEBTrigPrimPhase2ESProducer.cc.

References gzf.

115 { gzclose(gzf); }

◆ GzInputStream() [2/2]

GzInputStream::GzInputStream ( const char *  file)
inline

Definition at line 20 of file EcalTrigPrimESProducer.cc.

References eof, geometryDiff::file, gzf, and readLine().

20  : eof(false) {
21  gzf = gzopen(file, "rb");
22  if (gzf == Z_NULL) {
23  eof = true;
24  edm::LogWarning("EcalTPG") << "Database file " << file << " not found!!!";
25  } else
26  readLine();
27  }
Log< level::Warning, false > LogWarning

◆ ~GzInputStream() [2/2]

GzInputStream::~GzInputStream ( )
inline

Definition at line 41 of file EcalTrigPrimESProducer.cc.

References gzf.

41 { gzclose(gzf); }

Member Function Documentation

◆ operator bool() [1/2]

GzInputStream::operator bool ( ) const
inlineexplicit

Definition at line 42 of file EcalTrigPrimESProducer.cc.

References eof, and iss.

42 { return ((eof == true) ? false : !iss.fail()); }

◆ operator bool() [2/2]

GzInputStream::operator bool ( ) const
inlineexplicit

Definition at line 116 of file EcalEBTrigPrimPhase2ESProducer.cc.

References eof, and iss.

116 { return ((eof == true) ? false : !iss.fail()); }

◆ readLine() [1/2]

void GzInputStream::readLine ( )
inline

Definition at line 28 of file EcalTrigPrimESProducer.cc.

References buffer, Skims_PA_cff::content, eof, newFWLiteAna::found, gzf, and iss.

28  {
29  char *res = gzgets(gzf, buffer, 256);
30  eof = (res == Z_NULL);
31  if (!eof) {
32  iss.clear();
33  iss.str(buffer);
34  const auto content = iss.str();
35  std::size_t found = content.find("COMMENT");
36  if (found != std::string::npos) {
37  iss.str("");
38  }
39  }
40  }
Definition: Electron.h:6

◆ readLine() [2/2]

void GzInputStream::readLine ( )
inline

Definition at line 107 of file EcalEBTrigPrimPhase2ESProducer.cc.

References buffer, eof, gzf, and iss.

Referenced by GzInputStream(), and operator>>().

107  {
108  char *res = gzgets(gzf, buffer, 256);
109  eof = (res == Z_NULL);
110  if (!eof) {
111  iss.clear();
112  iss.str(buffer);
113  }
114  }
Definition: Electron.h:6

Member Data Documentation

◆ buffer

char GzInputStream::buffer

Definition at line 95 of file EcalEBTrigPrimPhase2ESProducer.cc.

Referenced by readLine().

◆ eof

bool GzInputStream::eof

Definition at line 97 of file EcalEBTrigPrimPhase2ESProducer.cc.

Referenced by GzInputStream(), operator bool(), and readLine().

◆ gzf

gzFile GzInputStream::gzf

Definition at line 94 of file EcalEBTrigPrimPhase2ESProducer.cc.

Referenced by GzInputStream(), readLine(), and ~GzInputStream().

◆ iss

std::istringstream GzInputStream::iss

Definition at line 96 of file EcalEBTrigPrimPhase2ESProducer.cc.

Referenced by operator bool(), operator>>(), and readLine().